Vamos a ver, lo acabo de hacer y no te garantizo que este libre de fallos. Pero parece que funciona:
Código Delphi
[-]
uses ComObj;
const
NET_FW_SCOPE_ALL = 0;
NET_FW_IP_VERSION_ANY = 2;
procedure Agregarme;
var
fwMgr: Variant;
Profile: Variant;
App: Variant;
begin
fwMgr:= CreateOleObject('HNetCfg.FwMgr');
Profile:= fwMgr.LocalPolicy.CurrentProfile;
App:= CreateOleObject('HNetCfg.FwAuthorizedApplication');
App.ProcessImageFileName:= ParamStr(0);
App.Name:= 'TuNombre';
App.Scope:= NET_FW_SCOPE_ALL;
App.IpVersion:= NET_FW_IP_VERSION_ANY;
App.Enabled:= TRUE;
Profile.AuthorizedApplications.Add(App);
end;
Probarlo, y si vemos que funciona bien, lo añadimos a la sección de trucos.