Questions tagged [windows-firewall-api]
59 questions
1
vote
2 answers
hnetcfg.dll throws BadImageFormatException
Executing code that references c:\windows\system32\hnetcfg.dll to manage the Windows Firewall from this question, causes a BadImageFormatException as soon as the DLL is loaded.
Opening the 414KB DLL file in NUnit for inspection throws the same…

Petrus Theron
- 27,855
- 36
- 153
- 287
1
vote
1 answer
Get specific firewall rule options
I would like to get a specific firewall rule by name and see the options it uses (The IP Scope specifically) and compare it to something. Is this possible, I searched online but couldn't find anything.
This is how I am adding rules:
INetFwPolicy2…

12shadow12
- 307
- 2
- 10
1
vote
1 answer
What are user rights to modify Windows firewall rules?
I'm trying to use COM objects from FirewallAPI.dll to set Windows Firewall rules programmatically from a C# application. The application is supposed to run under a user account that is not from the Administrators group.
I'm struggling with setting…

facetus
- 1,091
- 6
- 20
1
vote
1 answer
windows filterring platform WFP
hi I want to learn about windows filtering platform I am new i need tutorial or video to help me in my firewall project
what i really want is to stop packet with specific port and change the port then send the packet
please help me

dana.ba
- 11
- 2
1
vote
0 answers
How do you detect a windows firewall change?
Is there any way to get a notification / event when a rule is changed or the firewall enabled / disabled ?
(I'm using the FirewallAPI.DLL COM interface, but it doesnt seem to have any way of notification - you'd have to keep polling and iterating…

steve cook
- 3,116
- 3
- 30
- 51
1
vote
3 answers
VB.NET code adding Windows firewall exception just under private categorie, not public
I have a VB.NET routine that can add firewall exception, the problem is that I must add an exception under all types of network, be it private or public. But this routine add an exception just under the private category of Windows Firewall.
My…

blacblu
- 297
- 2
- 6
- 19
0
votes
1 answer
Want to understand why Powershell parameters are in some circumstances not functioning
I am aiming to list all available firewall rules by given filters and quite new to Powershell.
Observed a strange behavior which led me asking if there is something hidden that I am not aware of. I may use Pipes to accomplish the same, but I am…

Ali Avcı
- 870
- 5
- 8
0
votes
0 answers
INetFwRules getting stuck getting the count
My code is getting stuck trying to get the count of a INetFwRules interface. The code below never returns or throws and just seems to wait on the Get_count() call. Any suggestion where to check are appreciated.
template …

Thomas A. Bosler
- 63
- 5
0
votes
1 answer
Windows XP firewall blocks open connection made using C# socket
I make a client-server connection using C# sockets and while the connection is established in the client side I activate the firewall using the firewall api, after that, for some reason the client application becomes unable to send any data to the…

norkitt
- 1
0
votes
1 answer
Problem connecting 2 external IP Google Cloud Platafform
I created my VM(Google Cloud Platform), working with Windows Server 2008 R2. So i installed a program that needs the port 6900 opened to run. The program for work must connect to it own server that is: 200.229.50.3:6900. So i entered in the firewall…

Black Mamba
- 247
- 1
- 12
0
votes
1 answer
web api call took too long to respond ERR_CONNECTION_TIMED_OUT (TimedOut (0x274c))
I have created a very simple web API in C# and there is only one Get method. It's working fine from Visual Studio and IIS. But when I was trying to call it from client machine I was getting error XXX took too long to respond. Search google for XXX…

Aslam Murtuza
- 31
- 7
0
votes
0 answers
Windows logging/Firewall application that runs in the background, but also allows user interaction
I am looking to build a productivity app using the Windows Firewall API. The idea is that the user can open a desktop or a web app and use the UI to configure and schedule when he wants various websites or programs to be blocked, and a background…
0
votes
0 answers
How to return GPO applied firewall rules (INetFwPolicy2.Rules)?
Here is the C# code to return Firewall rules:
Type tNetFwPolicy2 = Type.GetTypeFromProgID("HNetCfg.FwPolicy2");
INetFwPolicy2 fwPolicy2 = (INetFwPolicy2)Activator.CreateInstance(tNetFwPolicy2);
List RuleList = new…

flux
- 1,518
- 1
- 17
- 31
0
votes
1 answer
How does one add services to the Windows Firewall trust list, or prompt the user to do the same?
I integrated a small http server in my software distribution, intended to allow access to my installed application from the customer's LAN.
Right now, the customer has to manually update the firewall's list of trusted applications. I want to either…

user497032
- 75
- 1
- 10
0
votes
1 answer
Restricting a Service using Windows Firewall APIs not finding service shortname
I am using the example to restrict all except one port for a specific windows service. I took the example from msdn and tried it for OpenVPN windows service. Basically I just edited these two lines:
BSTR bstrServiceName =…

Andy
- 186
- 1
- 4
- 23