473,511 Members | 16,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.Net application and WinXP SP2 Firewall

md
I recently installed Windows XP SP2 (Had no problems with it at all FWIW).
One of the applications I am writing has a server piece that communicates on
a TCP/IP port that is blocked by default in SP2. When I tried to run the
server the firewall asked me if I wanted to make an exception for this
application, which I did, and then the app worked just fine.

However, if you go into the Windows Firewall and go to the dialog where you
can edit the exceptions, my .net application has a blank where the other
exceptions show an application title or some text. My app shows nothing. I
took a look at all the version information in one of the applications that
the exception showed a name, but nothing in the version information matched
what the firewall was showing.

I haven't tried adding an exception to my application manually to see if
that helps. I'll do that, but I wondered if anyone has seen this and is
there a fix. IT doesn't interfere with the app in any way, it's just one of
those things I'd like to fix.

Thanks

Matt
Jul 21 '05 #1
1 2722
Matt,

I ran into the same problem and I'm in the process of investigating it. It
looks like you have to programatically add your app to the exceptions list.

Check this MSDN document for details..
http://msdn.microsoft.com/security/p...ll_devimp.aspx

I found that the example in the doc has a few typo's and the typelib used in
the doc is an older version ( all occurances of NetFw4 should just be NetFw,
and a few property names have changed ). I wrote the following sample, and
it builds... but I haven't tested it in an installer yet....

using System;
using System.Collections;
using System.ComponentModel;

using System.Configuration.Install;
using NetFwTypeLib;

namespace iWMS.ICFInstaller
{
[RunInstaller(true)]
public class ICFAppListInstaller : Installer
{
private string name, image, enabled;
private bool appEnabled = false;

private INetFwMgr GetNewManager()
{
INetFwMgr mgr = null;

try
{
mgr = (INetFwMgr) System.Activator.CreateInstance(
System.Type.GetTypeFromProgID( "HNetCfg.FwMgr" ) );
}
catch
{
}

return ( mgr );

}

private INetFwAuthorizedApplication GetNewAuthorizedApplication()
{
INetFwAuthorizedApplication app = null;

try
{
app = (INetFwAuthorizedApplication) System.Activator.CreateInstance(
System.Type.GetTypeFromProgID( "HNetCfg.FwAuthorizedApplication" )
);
}
catch
{
}

return ( app );

}

public override void Install(IDictionary state)
{
GetArgs();
base.Install(state);

INetFwMgr mgr = this.GetNewManager();

if( mgr == null )
return;

try
{
AddToPermissionsList(this.name, this.image, this.appEnabled,
mgr.LocalPolicy.CurrentProfile);
}
catch (Exception e)
{
Context.LogMessage(e.Message);
throw new InstallException(e.Message);
}
}

public override void Uninstall(IDictionary state)
{
GetArgs();

INetFwMgr mgr = this.GetNewManager();

if( mgr == null )
return;

try
{
RemoveFromPermissionsList(this.image, mgr.LocalPolicy.CurrentProfile);
base.Uninstall(state);
}
catch (Exception e)
{
Context.LogMessage(e.Message);
throw new InstallException(e.Message);
}
}

private void GetArgs()
{
name = this.Context.Parameters["Name"];
if (name == "")
throw new InstallException("No name specified");

image = this.Context.Parameters["Image"];
if (image == "")
throw new InstallException("No image name specified");

enabled = this.Context.Parameters["Enabled"];
switch (enabled.ToUpper())
{
case "1":
appEnabled = true;
break;
case "0":
appEnabled = false;
break;
}

}

private void AddToPermissionsList(string name, string imageName,
bool enabled, INetFwProfile profile)
{
INetFwAuthorizedApplication app = this.GetNewAuthorizedApplication();

app.Enabled = enabled;
app.Scope = NET_FW_SCOPE_.NET_FW_SCOPE_LOCAL_SUBNET;
app.Name = name;
app.ProcessImageFileName = imageName;

profile.AuthorizedApplications.Add(app);
}

private void RemoveFromPermissionsList(string imageName, INetFwProfile
profile)
{
profile.AuthorizedApplications.Remove( imageName );
}
}

}

"md" wrote:
I recently installed Windows XP SP2 (Had no problems with it at all FWIW).
One of the applications I am writing has a server piece that communicates on
a TCP/IP port that is blocked by default in SP2. When I tried to run the
server the firewall asked me if I wanted to make an exception for this
application, which I did, and then the app worked just fine.

However, if you go into the Windows Firewall and go to the dialog where you
can edit the exceptions, my .net application has a blank where the other
exceptions show an application title or some text. My app shows nothing. I
took a look at all the version information in one of the applications that
the exception showed a name, but nothing in the version information matched
what the firewall was showing.

I haven't tried adding an exception to my application manually to see if
that helps. I'll do that, but I wondered if anyone has seen this and is
there a fix. IT doesn't interfere with the app in any way, it's just one of
those things I'd like to fix.

Thanks

Matt

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1890
by: Bart Nessux | last post by:
for i in range(10000): try: n,v,t = EnumValue(open_key,i) # n == name of the registry object. # v == object's value. # t == object's type. print n,v,t except EnvironmentError: print "\nThere...
1
353
by: George Carman | last post by:
Please excuse the following mailing, I do not have access to a news server and cannot post to comp.lang.python. I recently installed Python 2.3.4 on WinXP. Command line interpreter works fine...
3
2201
by: Chuck | last post by:
Here is my setup. Netgear Router with a webserver and database server NAT'd behind the firewall. Microsoft Windows 2000, IIS 5 - Web Server Microsoft Windows 2000, MySQL - Database Server ...
383
11791
by: John Bailo | last post by:
The war of the OSes was won a long time ago. Unix has always been, and will continue to be, the Server OS in the form of Linux. Microsoft struggled mightily to win that battle -- creating a...
2
3553
by: Ralph | last post by:
I used to have Visual Basic .net std. 2003 installed on WinXP SP1A. But I found it too hard to upgrade WinXP to SP2. Now, I do have WinXP SP2 installed, but I am having problems installing...
3
2785
by: Rhino | last post by:
I've spent the last couple of hours trying to figure out how to debug a Java stored procedure and am just going in circles. The last straw came when I got "Cannot open input stream for default"...
3
5862
by: Frank Jiao | last post by:
I can get my local IPv6 address in Win2003 use the source code as below: string localName = Dns.GetHostName(); string address = ""; string scopeId = ""; IPHostEntry hostEntry = Dns.Resolve(...
1
304
by: md | last post by:
I recently installed Windows XP SP2 (Had no problems with it at all FWIW). One of the applications I am writing has a server piece that communicates on a TCP/IP port that is blocked by default in...
1
1648
by: Schalley Ben | last post by:
Hi First of all, this is my first post on a newsgroup so don't shoot me if I ask this in the wrong place. Here is the situation. I'm developing an asp.net application with access to a SQL...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5668
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.