"Fossies" - the Fresh Open Source Software Archive

Member "netxms-3.8.166/src/install/windows/firewall.iss" (23 Feb 2021, 1243 Bytes) of package /linux/misc/netxms-3.8.166.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Inno Setup source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 // Utility functions for Inno Setup
    2 //   used to add/remove programs from the windows firewall rules
    3 // Code originally from http://news.jrsoftware.org/news/innosetup/msg43799.html
    4 
    5 const
    6   NET_FW_SCOPE_ALL = 0;
    7   NET_FW_IP_VERSION_ANY = 2;
    8 
    9 Procedure SetFirewallException(AppName, FileName : string);
   10 var
   11   FirewallObject: Variant;
   12   FirewallManager: Variant;
   13   FirewallProfile: Variant;
   14 begin
   15   try
   16     FirewallObject := CreateOleObject('HNetCfg.FwAuthorizedApplication');
   17     FirewallObject.ProcessImageFileName := FileName;
   18     FirewallObject.Name := AppName;
   19     FirewallObject.Scope := NET_FW_SCOPE_ALL;
   20     FirewallObject.IpVersion := NET_FW_IP_VERSION_ANY;
   21     FirewallObject.Enabled := True;
   22     FirewallManager := CreateOleObject('HNetCfg.FwMgr');
   23     FirewallProfile := FirewallManager.LocalPolicy.CurrentProfile;
   24     FirewallProfile.AuthorizedApplications.Add(FirewallObject);
   25   except
   26   end;
   27 end;
   28 
   29 Procedure RemoveFirewallException(FileName : string);
   30 var
   31   FirewallManager: Variant;
   32   FirewallProfile: Variant;
   33 begin
   34   try
   35     FirewallManager := CreateOleObject('HNetCfg.FwMgr');
   36     FirewallProfile := FirewallManager.LocalPolicy.CurrentProfile;
   37     FireWallProfile.AuthorizedApplications.Remove(FileName);
   38   except
   39   end;
   40 end;