Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2013
    Posts
    5

    Trying to add exceptions to windows 7 and 8 firewall on instilation

    What im trying to do is add a section to my installers that either adds the updater exe to the windows firewall when the game installs or prompts the user to allow the exception on instilation. And then to remove it on uninstall. Any ideas how i might accomplish this. I found a bit on the forums but that was for xp and vista. Thank you all for your help in advance.

    Jander

  2. #2
    Join Date
    Jul 2008
    Location
    Switzerland
    Posts
    260
    command line on Windows 7

    Code:
    netsh advfirewall firewall add rule ?
    Code:
    Examples:
    
    Adding a rule for incoming traffic without security encapsulation for messenger.exe:
    netsh advfirewall firewall add rule name="allow messenger" dir=in program="c:\programfiles\messenger\msmsgs.exe" security=authnoencap action=allow
    
    
    Adding a rule for outgoing traffic at the port 80:
    netsh advfirewall firewall add rule name="allow80" protocol=TCP dir=out localport=80 action=block
    
    
    Adding rules to inbound traffic with safety & traffic encryption for TCP through port 80:
    netsh advfirewall firewall add rule name="Require Encryption for Inbound TCP/80" protocol =TCP dir=in localport=80 security=authdynenc action=allow

    regards

  3. #3
    Join Date
    Sep 2012
    Posts
    1
    This might be useful for those creating installers that work on XP through Windows 8/Server 2012. It opens the firewall for your app executable on all platforms. Just set the filepathvariable to the full path to your app executable.

    -- delete current versions of the firewall rule then add the rule again
    -- different commands for XP/2003 and Vista and above

    osname = System.GetOSName();

    if (osname == "Windows Server 2003" or osname == "Windows XP") then

    -- xp and 2003 only - delete current versions of the firewall rule
    fw_del_cmd = 'firewall delete allowedprogram program = \"' .. filepathvariable .. '\"';
    result = Shell.Execute("netsh.exe", "open", fw_del_cmd, SessionVar.Expand("%SystemFolder%"), SW_HIDE, true);

    -- xp and 2003 only - add the firewall rule
    fw_cmd = 'firewall add allowedprogram program = \"' .. filepathvariable .. '\" name = \"My Application\" mode = ENABLE';
    result = Shell.Execute("netsh.exe", "open", fw_cmd, SessionVar.Expand("%SystemFolder%"), SW_HIDE, true);

    else

    -- delete current versions of the firewall rule
    fw_del_cmd = 'advfirewall firewall delete rule name=\"My Application\"';
    result = Shell.Execute("netsh.exe", "open", fw_del_cmd, SessionVar.Expand("%SystemFolder%"), SW_HIDE, true);

    -- add the firewall rule
    fw_cmd = 'advfirewall firewall add rule name=\"My Application\" dir=in action=allow program=\"' .. filepathvariable .. '\" description=\"Traffic allowed for all protocols on all ports when coming from my app\"';
    result = Shell.Execute("netsh.exe", "open", fw_cmd, SessionVar.Expand("%SystemFolder%"), SW_HIDE, true);

    end

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts