I need to determine the status of the Windows firewall (that is, whether it is turned on or not) to display a message warning that the firewall rule can be configured to allow incoming connections on certain ports when the firewall is turned on, but not when it is not. Sample code below:
[Code]
//Check if Windows Firewall is enabled
function IsWindowsFirewallEnabled(): Boolean;
begin
//Method required here
Result := True;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
//Display a warning message on a Server install if Windows Firewall is enabled
if CurPageID = wpSelectComponents and IsComponentSelected('Server') and IsWindowsFirewallEnabled then
begin
MsgBox('Windows Firewall is currently enabled.' +
'You may need to enable inbound connections on ports 2638, 445 and 7.'
mbInformation, MB_OK);
Result := True;
end;
end;
I need a method for a function IsWindowsFirewallEnabled. One of the methods that I read about, and, ironically, now more or less suggested below, while I was in the middle of updating the question with this information, in any case, it seems to read the value EnableFirewallfrom the registry:
//Check if Windows Firewall is enabled
function IsWindowsFirewallEnabled(): Boolean;
var
crdFirewallState: Cardinal;
begin
RegQueryDwordValue(HKLM, 'SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile',
'EnableFirewall', crdFirewallState);
if crdFirewallState = 1 then
Result := True;
end;
, , , , ( , ).
, Windows XP, Server 2003, Windows Vista Server 2008 .
, ?