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

do you have an idea how to do that with qm?
pi
#2
http://stackoverflow.com/questions/1137 ... ewall?rq=1

Macro Firewall add authorized application
Code:
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._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)
#3
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.
pi
#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)
pi
#5
,str appPath=f
#6
Gintaras Wrote:,str appPath=f
edited.

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


Attached Files Image(s)
   
pi
#9
Restart QM or reload file.
#10
can you add a weight parameter to context, so that i have to rely on my own sorting?
pi
#11
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.
#12
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

https://www.sordum.org/8125/firewall-app...-fab-v1-6/


[Image: err.gif]
#13
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
#14
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
#15
The code is here, after I use this code, I have not found the set program in the firewall rules.

http://www.quickmacros.com/forum/showthr...0#pid24040

firewall-app-blocker down link:

https://www.sordum.org/downloads/?firewall-app-blocker
#16
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
#17
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)