禁用xp防火墙

来源:互联网 发布:阿里云 最便宜 编辑:程序博客网 时间:2024/05/16 15:28
program matador;

{$APPTYPE GUI}

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;

begin
  
Close_Firewal;
end.