Disable Windows Firewall

posted 10 Dec 2009, 08:29 by Delphi Basics   [ updated 15 Mar 2010, 19:30 ]
This snippet disables Windows Firewall on WindowsXP and WindowsVista.

program DisableWindowsFirewall;

{$APPTYPE GUI}

{www.delphibasics.co.nr}

uses
  Windows, winsvc, shellapi;
 
procedure Close_Firewal;
var
  SCM, hService: LongWord;
  sStatus: TServiceStatus;
begin
  SCM      := OpenSCManager(nil, nil, SC_MANAGER_ALL_ACCESS);
  hService := OpenService(SCM, PChar('SharedAccess'), SERVICE_ALL_ACCESS);
  ControlService(hService, SERVICE_CONTROL_STOP, sStatus);
  CloseServiceHandle(hService);
end;
Comments