国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

如何透過程序來控制 Windows XP防火墻的開關

瀏覽:123日期:2023-07-02 15:28:57

Dim;objFW;As;Object;;;Set;objFW;=;CreateObject('HNetCfg.FwMgr').LocalPolicy.CurrentProfileWith;objFW.FirewallEnabled;=;True;';True;開啟;,;False;關閉.ExceptionsNotAllowed;=;True;';[;不允許例外;];選項;,;True;勾;,;反之則不勾End;With或procedure;Set_WindowsXP_FireWall(Enable:;boolean);//;需引用;winsvc,;shellapi//;Set_WindowsXP_FireWall(false);;//;關閉Windows;Xp;防火//varSCM,;hService:;LongWord;sStatus:;TServiceStatus;beginif;Enable;=;false;thenbeginSCM;:=;OpenSCManager(nil,;nil,;SC_MANAGER_ALL_ACCESS);hService;:=;OpenService(SCM,;PChar('SharedAccess'),;SERVICE_ALL_ACCESS);ControlService(hService,;SERVICE_CONTROL_STOP,;sStatus);CloseServiceHandle(hService);end;end;設定Port;的部份,不過還沒測試!不過我還是希望寫成簡單形式的函數庫呼叫方式,大家一起測試吧!出處:http://www-new.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_22122056.htmlExample;of;both;adding;and;removing;a;tcp;port;from;the;globaly;open;ports;list;(in;Windows;XP;firewall)Regards,Russell//;Include;ActiveX;and;ComObj;in;uses;clause;(also;Variants;for;D6;and;up)constNET_FW_PROFILE_DOMAIN;;;;;;=;;0;NET_FW_PROFILE_STANDARD;;;;=;;1;constNET_FW_IP_PROTOCOL_TCP;;;;;=;6;NET_FW_IP_PROTOCOL_UDP;;;;;=;17;constNET_FW_SCOPE_ALL;;;=;;0;constNET_FW_IP_VERSION_ANY;;;;;;=;;2;implementation{$R;*.DFM}procedure;TForm1.Button1Click(Sender:;TObject);var;;ovMgr:;OleVariant;ovProfile:;;;;;OleVariant;ovPort:OleVariant;begin//;Create;manager;interfaceovMgr:=CreateOleObject('HNetCfg.FwMgr');//;Resource;protectiontry//;Get;local;profile;interfaceovProfile:=ovMgr.LocalPolicy.CurrentProfile;//;Resource;protectiontry//;Create;new;port;interfaceovPort:=CreateOleObject('HNetCfg.FwOpenPort');try//;Set;port;propertiesovPort.Port:=81;ovPort.Name:='Whatever';ovPort.Scope:=NET_FW_SCOPE_ALL;ovPort.IpVersion:=NET_FW_IP_VERSION_ANY;ovPort.Protocol:=NET_FW_IP_PROTOCOL_TCP;ovPort.Enabled:=True;//;Resource;protectiontry//;Add;to;globally;open;portsovProfile.GloballyOpenPorts.Add(ovPort);//////;....;do;whatever;....////finally//;Remove;from;globally;open;portsovProfile.GloballyOpenPorts.Remove(81,;NET_FW_IP_PROTOCOL_TCP);end;finally//;Release;interfaceovPort:=Unassigned;end;finally//;Release;interfaceovProfile:=Unassigned;end;finally//;Release;interfaceovMgr:=Unassigned;end;end;

標簽: Windows系統
主站蜘蛛池模板: 欧美亚洲日本一区二区三区浪人 | 久久久精品久久视频只有精品 | 八戒午夜精品视频在线观看 | 欧美精品一区二区三区免费播放 | 香港三级日本三级三级人妇 | 欧美高清在线精品一区 | 中文字幕无线码中文字幕网站 | 亚州免费一级毛片 | 日本九九视频 | 日韩欧美一区二区三区在线观看 | 欧美高h视频 | 亚洲成a人片毛片在线 | 亚洲精品福利一区二区三区 | 久久精品中文字幕一区 | 欧美成人四级hd版 | 国产中文字幕在线观看 | 国产在线播放不卡 | 中文精品久久久久国产网址 | 欧美韩国xxx | 日产一区2区三区有限公司 日产一区两区三区 | 步兵精品手机在线观看 | 成年女人毛片免费播放视频m | 国产在线91精品入口首页 | 亚洲第一网站在线观看 | 久草久草视频 | 久久精品店| www.日本在线视频 | 亚洲三级黄色片 | 天堂素人搭讪系列嫩模在线观看 | 亚州视频一区 | 久久亚洲精品23p | 欧美一级乱理片免费观看 | 精品久久久久久综合网 | 日本精品视频一视频高清 | 国产日韩精品欧美一区喷 | 亚州在线播放 | 米奇久久 | 精品韩国主播福利视频在线观看一 | 明星国产欧美日韩在线观看 | 亚洲国产最新在线一区二区 | 99国产小视频 |