问题描述
我下面提到了将我的应用程序添加到Windows防火墙异常列表中的代码。
我想知道这是否也适用于其他防火墙,例如:防病毒防火墙等。
如果没有,请提出解决方案。
注意:我的应用程序正在运行管理员权限,但我的用户无法了解quickheal等的防火墙设置。我使用Delphi 2007(Win32)。
这是我第一次使用这个论坛。请原谅+更正任何错误。
致歉
Allan Fernandes
procedure AddApplicationToFirewall(EntryName:string; ApplicationPathAndExe:string);
var
fwMgr,app:OleVariant;
个人资料:OleVariant;
begin
fwMgr:= CreateOLEObject('HNetCfg.FwMgr');
profile:= fwMgr.LocalPolicy.CurrentProfile;
app:= CreateOLEObject('HNetCfg.FwAuthorizedApplication');
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);
结束
@Allan,你的代码只适用于Windows防火墙或者使用Windows防火墙例外列表的防火墙。
不幸的是,没有标准的方式向第三方防火墙添加异常,因为大多数防火墙都使用自己的方法来处理异常和访问规则。 b $ b
I got below mentioned code for adding my application to Windows Firewall Exception list.I wanted to know if this will also work for other firewalls eg: Antivirus firewalls etc.If not then please suggest a solution. Note: My application is running with Admin rights but my users are not able to understand firewall settings of quickheal etc. I use Delphi 2007 (Win32).
This is the first time I am using this forum. Please excuse+correct any mistakes.
Regards Allan Fernandes
procedure AddApplicationToFirewall(EntryName:string;ApplicationPathAndExe:string);
var
fwMgr,app:OleVariant;
profile:OleVariant;
begin
fwMgr := CreateOLEObject('HNetCfg.FwMgr');
profile := fwMgr.LocalPolicy.CurrentProfile;
app := CreateOLEObject('HNetCfg.FwAuthorizedApplication');
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);
end;
@Allan, your code only works for the windows firewall or for Firewalls wich uses the windows firewall exceptions list.
unfortunately there is no standard way of adding exceptions to third-party firewalls, since most of these use their own methods to handle exceptions and access rules.
这篇关于添加到防火墙例外列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!