In a innosetup installer, my goal is to configure the Windows firewall to open the adequate port for my software
[Run]
Filename: "{sys}\netsh.exe"; Parameters: "firewall set portopening protocol=TCP port=""{code:GetServerPort()}"" name=NxTCP mode=ENABLE"; StatusMsg: "Opening TCP Port ""{code:GetServerPort()}"; Flags: runhidden
[Code]
function GetServerPort(): String;
begin
Result := "5555"; //obtained with the Wizard
end;
And I get this error
Required function or procedure 'GetServerPort()' not found.
Or if I drop the ()
at the call
Invalid prototype for 'GetServerPort'
This code works for me:
[Run]
Filename: "{sys}\netsh.exe"; Parameters: "firewall set portopening protocol=TCP port=""{code:GetServerPort}"" name=NxTCP mode=ENABLE"; StatusMsg: "Opening TCP Port ""{code:GetServerPort}"; Flags: runhidden
[Code]
function GetServerPort(Value: string): String;
begin
Result := '5555'; //obtained with the Wizard
end;
Your function call in the [Run]
is not properly formatted. The {code:XXX}
is basically a Check
parameter and is documented at http://www.jrsoftware.org/ishelp/topic_scriptcheck.htm