I have an application that is a Windows Service (Windows Service) and per feature account I'm looking for to add a method to add it to Windows
So:
procedure AddInFirewall(cApplicationName, cEntryName: string);
var
cAppName: string;
begin
if Trim(cApplicationName) = '' then
cAppName := Application.ExeName
else
cAppName := cApplicationName;
if Trim(cEntryName) = '' then
begin
cEntryName := ExtractFileName(cAppName);
end;
WinExec(PAnsiChar(AnsiString('netsh firewall delete allowedprogram ' + cAppName)), SW_HIDE);
WinExec(PAnsiChar(AnsiString('netsh advfirewall firewall delete rule name="'+cEntryName+'" program="'+cAppName+'"')), SW_HIDE);
WinExec(PAnsiChar(AnsiString('netsh firewall add allowedprogram '+cAppName+' "'+cEntryName+'" ENABLE')), SW_HIDE);
WinExec(PAnsiChar(AnsiString('netsh advfirewall firewall add rule name="'+cEntryName+'" dir=in action=allow program="'+cAppName+'" enable=yes')), SW_HIDE);
end;
procedure TServerModule.DataModuleCreate(Sender: TObject);
begin
AddInFirewall(Application.ExeName, 'MeuServico');
FClients := TList.Create;
StartService;
end;
However, the blessed AVG antivirus is complaining that it is infected with:
Win32 / DH {IFVEIS4}
Just comment the lines with WinExec
and compile again that it no longer complains of infection.
How can I resolve this problem?