问题
Is there any way to programmatically add an .exe file to the exception list for the Windows Vista firewall to allow it to run normally? I'm using VC++.
回答1:
Yes - if you take a look at the WindowsFirewallAddApp method here, it should give you some ideas how to do it.
回答2:
I don't know for certain about the Vista firewall, but I would defeinitely excpect that it is a violation of the security of any computer to allow programmatic access to firewall exception lists. I would be very surprised if Windows allowed arbitrary code to fiddle with the Firewall in this way.
The user sitting in front of the computer, or a network administrator setting network wide security policies would be the only two who should be able to do this. Notice that they are both actual people doing the process interactively.
来源:https://stackoverflow.com/questions/1409896/programmatically-add-exception-to-windows-vista-firewall