Announcement

Collapse
No announcement yet.

Setting Firewall by Registry

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting Firewall by Registry

    How can I get this to work?
    I'm trying to replace "Data" in |App=Data| in the below code with no luck.

    Code:
    Data = SessionVar.Expand("%AppFolder%\\Setup.exe");
    
    Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\ControlSet001\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\FirewallRules","{91F7E1FE-37CF-4C24-8FA9-55380C8DC1CE}","v2.24|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Private|Profile=Public|App=Data|Name=Setup.exe|",REG_SZ);

  • #2
    That probably should be
    Code:
    Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\ControlSet001\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\FirewallRules","{91F7E1FE-37CF-4C24-8FA9-55380C8DC1CE}","v2.24|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Private|Profile=Public|App=" .. Data .. "|Name=Setup.exe|",REG_SZ);
    However, I believe that a better way than editing the registry for opening the firewall would be calling the netsh utility in the %SystemFolder%, and pass the proper parameters like advfirewall firewall add rule program= ...

    Ulrich

    Comment


    • #3
      Setting Firewall Rules

      Attached are two functions that I use, OpenFirewallToApp(), and CloseFirewallToApp().

      Enjoy!
      Attached Files

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎