Search code examples
winapiwindows-firewall

What API calls are involved in opening a port in the Windows Firewall?


I have a batch file that installs WinVNC in about 1 second and starts up the service. However, I still have to manually go into the Windows Firewall and open a port to allow connections. How can I do that programmatically?

If I could do it from inside the batch file, that would be ideal, but I'm ok writing an EXE if that's necessary.


Solution

  • Let me google that for you:
    http://www.windowsecurity.com/articles/Customizing-Windows-Firewall.html

    This page includes a multitude of ways to customize the firewall, among those the use of netsh.exe that seem to give command line access to windows firewall.