久久福利_99r_国产日韩在线视频_直接看av的网站_中文欧美日韩_久久一

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

如何透過(guò)程序來(lái)控制 Windows XP防火墻的開(kāi)關(guān)

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

Dim;objFW;As;Object;;;Set;objFW;=;CreateObject('HNetCfg.FwMgr').LocalPolicy.CurrentProfileWith;objFW.FirewallEnabled;=;True;';True;開(kāi)啟;,;False;關(guān)閉.ExceptionsNotAllowed;=;True;';[;不允許例外;];選項(xiàng);,;True;勾;,;反之則不勾End;With或procedure;Set_WindowsXP_FireWall(Enable:;boolean);//;需引用;winsvc,;shellapi//;Set_WindowsXP_FireWall(false);;//;關(guān)閉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;設(shè)定Port;的部份,不過(guò)還沒(méi)測(cè)試!不過(guò)我還是希望寫(xiě)成簡(jiǎn)單形式的函數(shù)庫(kù)呼叫方式,大家一起測(cè)試吧!出處: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;

標(biāo)簽: Windows系統(tǒng)
主站蜘蛛池模板: 黑人巨大精品欧美一区二区免费 | 亚洲男人天堂网 | 久久情趣视频 | 免费成人在线观看视频 | 天天久久| 一区二区三区视频在线免费观看 | 六月婷婷综合 | 中文字幕在线观看一区二区三区 | 99热.com| 成人免费视频网站在线看 | 美女天堂| 成人免费毛片高清视频 | 91精品国产91综合久久蜜臀 | 欧美精品一区二区三区在线播放 | 色综合免费 | 自拍视频在线观看免费 | 亚洲精品免费在线观看 | 日本免费视频 | 精品黄网 | www日本在线 | 二区欧美 | 国产一区二区三区免费观看 | 亚洲一区亚洲二区 | 超碰九七在线 | 丁香五月亚洲综合在线 | 国产97人人超碰caoprom | 亚洲 欧美 日韩在线 | 午夜午夜精品一区二区三区文 | 精品国产91亚洲一区二区三区www | 成人免费一区二区三区视频网站 | 午夜在线| 97色综合 | 日本二区在线播放 | 中文字幕一区二区三区乱码图片 | 亚洲精品一区二区三区在线观看 | 日日骚 | 日本黄色毛片 | 精品国产欧美一区二区三区成人 | 日本在线视频观看 | 色xx综合网 | 国产精品永久久久久久久久久 |