Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7490471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:36:43+00:00 2026-05-29T15:36:43+00:00

I have this chunk of code which I found and implemented according to http://www.activexperts.com/activmonitor/windowsmanagement/scripts/networking/windowsfirewall/

  • 0

I have this chunk of code which I found and implemented according to http://www.activexperts.com/activmonitor/windowsmanagement/scripts/networking/windowsfirewall/

procedure AddExceptionToFirewall (Caption: String; Executable: String);
var
  FirewallMsg: OleVariant;
  Application: OleVariant;
  CurrentProfile: OleVariant;
begin
  FirewallMsg:= CreateOLEObject ('HNetCfg.FwMgr');
  CurrentProfile:= FirewallMsg.LocalPolicy.CurrentProfile;
  Application:= CreateOLEObject ('HNetCfg.FwAuthorizedApplication');
  Application.ProcessImageFileName:= Executable;
  Application.Name:= Caption;
  Application.Scope:= FW_SCOPE_ALL;
  Application.IpVersion:= FW_IP_VERSION_ANY;
  Application.Enabled:= True;
  CurrentProfile.AuthorizedApplications.Add (Application);
end;

The thing is, on Windows 7, it adds the exception only as Public and not as Private as you can see circled in RED in here

enter image description here

When set to Public only, my program has problems accessing my host via an FTP connection, thus rendering my program useless.
This problem is particular only for Windows Vista/7; on XP, the current configuration works fine.

Please if you have any clue or helpful pointers, share them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:36:45+00:00Added an answer on May 29, 2026 at 3:36 pm

    Starting with windows Vista you must use the INetFwPolicy2 and INetFwRule interfaces to gain access to the new firewall features.

    Try this sample which add a new rule in the Public and Private profile.

    procedure AddExceptionToFirewall(Const Caption, Executable: String);
    const
    NET_FW_PROFILE2_DOMAIN  = 1;
    NET_FW_PROFILE2_PRIVATE = 2;
    NET_FW_PROFILE2_PUBLIC  = 4;
    
    NET_FW_IP_PROTOCOL_TCP = 6;
    NET_FW_ACTION_ALLOW    = 1;
    var
      fwPolicy2      : OleVariant;
      RulesObject    : OleVariant;
      Profile        : Integer;
      NewRule        : OleVariant;
    begin
      Profile             := NET_FW_PROFILE2_PRIVATE OR NET_FW_PROFILE2_PUBLIC;
      fwPolicy2           := CreateOleObject('HNetCfg.FwPolicy2');
      RulesObject         := fwPolicy2.Rules;
      NewRule             := CreateOleObject('HNetCfg.FWRule');
      NewRule.Name        := Caption;
      NewRule.Description := Caption;
      NewRule.Applicationname := Executable;
      NewRule.Protocol := NET_FW_IP_PROTOCOL_TCP;
      NewRule.Enabled := TRUE;
      NewRule.Profiles := Profile;
      NewRule.Action := NET_FW_ACTION_ALLOW;
      RulesObject.Add(NewRule);
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this chunk of code which adds up all the players hurt on
Hi all I have found some really good code over on http://apptools.com thats helped
I have this chunk of code which is placed in accelerometer: didAccelerate which changes
If I have a chunk of code like this: .hover( function () { hoverState($(#navbar
Let's say you have the following chunk of code: <div id=container> <someelement>This is any
I've seen related posts on other forums about this (see: http://www.mrexcel.com/forum/showthread.php?t=372534 ), but I've
I have this string containing a large chunk of html and am trying to
I have this code in jQuery, that I want to reimplement with the prototype
Cheers, I ran into this chunk of code in Programming Game AI by Example:
I have a small chunk of code I can't seem to get working. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.