본문 바로가기
삽질/Delphi

[Delphi] InnoSetup : 방화벽 추가 (netsh.exe)

by 푸딩s 2021. 8. 30.

# WIN 7 이상 
[Run]
Filename: {sys}\netsh.exe; Parameters: "advfirewall firewall add rule name=""MyApp"" protocol=TCP dir=in program=""{app}\MyApp.exe"" action=allow localport=""8100,443"""; StatusMsg: "MyApp"; Flags: runhidden

[UninstallRun]
Filename: {sys}\netsh.exe; Parameters: "advfirewall firewall delete rule name=""MyApp"" program=""{app}\MyApp.exe"""; Flags: runhidden

 

# WIN XP 이하
[Run]
Filename: {sys}\netsh.exe; Parameters: "firewall add allowedprogram program=""{app}\MyApp.exe"" name=""MyApp"""; Flags: runhidden
Filename: {sys}\netsh.exe; Parameters: "firewall add portopening protocol=TCP port=8100 name=MyApp"; Flags: runhidden

[UninstallRun]
Filename: {sys}\netsh.exe; Parameters: "firewall delete allowedprogram ""{app}\MyApp.exe"""; Flags: runhidden

댓글0