2014-01-24, 08:58 PM
I'm trying to work out a way to add inbound port rules to Windows Firewall. It seems there are 2 APIs - the one introduced with XP SP2 and the "advanced" API added in Vista.
It seems rules created with the XP API approach would be valid for Vista and later but it is recommended to use the advanced API. One problem is the MS code samples for the XP API are in C++ and I'd rather use C# - another problem is the samples for the advanced can't be built in VS2010 on my XP machine because they need to reference a system dll (or a version of it) which only comes with Vista and later.
I thought about just using a shell to execute the netsh CLI using "netsh firewall" or "netsh advfirewall" commands depending on OS version but I've never been keen on executing a command-line program from within a .NET program.
Any thoughts / ideas gratefully received.
Cheers,
Brian
It seems rules created with the XP API approach would be valid for Vista and later but it is recommended to use the advanced API. One problem is the MS code samples for the XP API are in C++ and I'd rather use C# - another problem is the samples for the advanced can't be built in VS2010 on my XP machine because they need to reference a system dll (or a version of it) which only comes with Vista and later.
I thought about just using a shell to execute the netsh CLI using "netsh firewall" or "netsh advfirewall" commands depending on OS version but I've never been keen on executing a command-line program from within a .NET program.
Any thoughts / ideas gratefully received.
Cheers,
Brian