Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Allow, Block Or Remove Apps Windows Firewall
#4
Function Firewall
Trigger $sm "Options\Firewall" 0x0 "exe" "" "Allow, Block Or Remove Apps From Windows Firewall"     Help - how to add the trigger to the macro
Code:
Copy      Help
function $files
str f
foreach f files
,str appName = f.getfilename
,str appPath.expandpath(f)
,
,typelib NetFwTypeLib {58FBCF7C-E7A9-467C-80B3-FC65E8FCCA08} 1.0
,
,NetFwTypeLib.INetFwMgr manager._create("{304CE942-6E39-40D8-943A-B913C40C9CD4}")
,NetFwTypeLib.INetFwAuthorizedApplications apps=manager.LocalPolicy.CurrentProfile.AuthorizedApplications
,NetFwTypeLib.INetFwAuthorizedApplication a
,
,int i=list("Allow[]Block[]Find[]Remove" appPath "Firewall")
,sel i
,,case [1,2] ;;add
,,a._create("HNetCfg.FwAuthorizedApplication")
,,a.Name=appName
,,a.ProcessImageFileName=appPath
,,a.Enabled=iif(i=1 TRUE 0)
,,apps.Add(a)
,,
,,case 3 ;;find
,,int isInList
,,foreach(a apps) if(appPath~_s.from(a.ProcessImageFileName)) isInList=1; break
,,mes F"{iif(isInList `found` `not found`)}[]{appPath}"
,,
,,case 4 ;;remove
,,apps.Remove(appPath)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)