Git   发布时间:2022-04-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了XP的Windows防火墙规则大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何以编程方式将应用程序或端口添加到Windows XP上的Windows防火墙?

TThread等待用户input

应该使用SHellExecute来打开认的邮件程序,怎样才能正确完成?

如果我调用SHellExecuteEx,为什么GetExitCodeProcess说程序被终止,即使它仍在运行?

我在哪里可以find一个Windows API常量列表,在一个没有.NET的环境

获取FileSystem限制

试试从我们的开源sqlite3UI.pas单元中提取的@L_450_11@:

function GetXPFirewall(var fwMgr,profile: OleVariant): Boolean; begin Result := (Win32Platform=VER_PLATFORM_WIN32_NT) and (Win32MajorVersion>5) or ((Win32MajorVersion=5) and (Win32MinorVersion>0)); if result then // need Windows XP at least try fwMgr := CreateOLeobject('HNetCfg.FwMgr'); profile := fwMgr.LocalPolicy.CurrentProfile; except on E: Exception do result := false; end; end; const NET_FW_PROFILE_DOMAIN = 0; NET_FW_PROFILE_STANDARD = 1; NET_FW_IP_VERSION_ANY = 2; NET_FW_IP_PROTOCOL_UDP = 17; NET_FW_IP_PROTOCOL_TCP = 6; NET_FW_SCOPE_ALL = 0; NET_FW_SCOPE_LOCAL_subnet = 1; procedure AddApplicationToXPFirewall(const EntryName,ApplicationPathAndExe: String); var fwMgr,profile,app: OleVariant; begin if GetXPFirewall(fwMgr,profilE) then try if profile.FirewALLENabled then begin app := CreateOLeobject('HNetCfg.FwAuthorizedApplication'); try app.processImageFilename := ApplicationPathAndExe; app.Name := EntryName; app.Scope := NET_FW_SCOPE_ALL; app.IpVersion := NET_FW_IP_VERSION_ANY; app.Enabled :=true; profile.AuthorizedApplications.Add(app); finally app := varNull; end; end; finally profile := varNull; fwMgr := varNull; end; end; procedure AddPortToXPFirewall(const EntryName: String; Portnumber: cardinal); var fwMgr,port: OleVariant; begin if GetXPFirewall(fwMgr,profilE) then try if profile.FirewALLENabled then begin port := CreateOLeobject('HNetCfg.FWOpenPort'); port.Name := EntryName; port.Protocol := NET_FW_IP_PROTOCOL_TCP; port.Port := Portnumber; port.Scope := NET_FW_SCOPE_ALL; port.Enabled := true; profile.GloballyOpenPorts.Add(port); end; finally port := varNull; profile := varNull; fwMgr := varNull; end; end;

它将允许您将应用程序或端口添加到XP防火墙。 应该从Delphi 6工作到XE。

可以编写Windows防火墙脚本 ,请参阅脚本化Windows防火墙

和@L_450_11@示例在这里

大佬总结

以上是大佬教程为你收集整理的XP的Windows防火墙规则全部内容,希望文章能够帮你解决XP的Windows防火墙规则所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: