Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Allow, Block Or Remove Apps Windows Firewall
Allow, Block Or Remove Apps From Windows Firewall Using Context Menu ... text-menu/

do you have an idea how to do that with qm?
#2 ... ewall?rq=1

Macro Firewall add authorized application
Copy      Help
str appName="Atest"
str appPath.expandpath("$my qm$\Atest.exe")

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.Enabled=iif(i=1 TRUE 0)
,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
very cool!
so instead of installing a 3rd party software which also clutter my already huge context menu on exe, i add the firewall entry to my Options sub menu.

again: thank you for your fast support.
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
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.Enabled=iif(i=1 TRUE 0)
,,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
,str appPath=f
Gintaras Wrote:,str appPath=f

the Firewall entry is last in order in my context menu, how to i move it up?
Don't remember, probably menu items are ordered like QM items in the main list when QM started.
they seem to be sorted by Date modified:
Firewall 11.12.2013 22:20
Autostart 22.06.2007 23:56

Attached Files Image(s)
Restart QM or reload file.
can you add a weight parameter to context, so that i have to rely on my own sorting?
Move all context menu macros to a single folder in QM, order as you like, and restart QM. It will be easier and more clear than adding more parameters.
I often use the software Firewall App Blocker to add firewall rules. Today I found the above code. After testing, I found that it could not take effect. Huh

system: windows 7 ,  64bit

[Image: err.gif]
I opened the firewall and checked the settings of the rules. I found that the above code failed. The settings of Firewall App Blocker are successful. I hope someone can help me test it. Thanks. Smile
looking at your attachment it seems your add/block code is not successful. Why i cannot say. Don't have that program.

post your qm code here please
The code is here, after I use this code, I have not found the set program in the firewall rules.

firewall-app-blocker down link:
the code works for me if i add it shows says found if i remove it says not found. Don't need the other program but if you use latest version 1.6 it will show the added rule in that program
After the code runs, select Block, run the code again, select Find, although it can be found, 

but there are no rules added in the system firewall, and I can't see the added items using the latest Firewall App Blocker (Fab) v1.6.

I don't use code, directly added any program using Firewall App Blocker (Fab) v1.6, which I can see in the firewall rules.

system: win7  x64

Forum Jump:

Users browsing this thread: 1 Guest(s)