WFP with C#

Hi I have already written an application some time ago in C# using sockets to do many things but as you will know they dont expose the functionality or efficiency of the job in hand when creating a firewall for instance. I recently came across WFP and have been reading any documentation I can find, unfortunately for me its all referring to C++.

I could generally port code over but after reading the welcome thread in this forum I saw a statement that this platform is aimed at C/C++ developers, so is it going to be pointless trying to utilize WFP using C# considering it may need lower-level driver functionaility etc?

Thanks alot for any advice

JWH

[685 byte] By [JohnWesleyHarding] at [2008-1-27]
# 1
Hello.

I don't have any C# experience whatsoever, but I will share what I know about WFP as no one else seems to be replying to you...

I am willing to bet there is no C# in kernelspace. In fact, I wouldn't even try using C++ in kernelspace, just plain old vanilla C. So callout drivers are going to require some C and windows kernel coding.

However, if what you are trying to accomplish can be done using only the usermode APIs (those documented in the Windows SDK, and not in the DDK), then you have a chance in getting them to work. I am told that there is some sort of compatibility interface for C# which allows you to call C apis from C#. All the usermode API of WFP is is a C API, which you get by #include <fwpmu.h> and live in fwpuclnt.dll. So, calling the WFP management APIs should reduce to the question: can you call C-language APIs from C#, which take OUT pointers, IN OUT pointers, etc. If so, then you should be able to call the WFP management APIs.

Hope this answers your question.

JeremyDrake at 2007-9-28 > top of Msdn Tech,Windows Networking Development,Windows Filtering Platform (WFP)...
# 2

Hi,

The user mode WFP APIs cannot currently be called from C#.

One possibility could be to add managed C++ wrappers around the WFP structures.

PhilippeJoubert[MSFT] at 2007-9-28 > top of Msdn Tech,Windows Networking Development,Windows Filtering Platform (WFP)...
# 3
What you can do is a Managed C++ Application that calls the underlying WFP API and have a C# that calls this Managed api. I've done that and it's working fine for me.
sergio.clemente at 2007-9-28 > top of Msdn Tech,Windows Networking Development,Windows Filtering Platform (WFP)...
# 4

is there any one have sdk for c#
CemalErdemir at 2007-9-28 > top of Msdn Tech,Windows Networking Development,Windows Filtering Platform (WFP)...