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;