- Notifications
You must be signed in to change notification settings - Fork12
PInvoke wrapper for WinDivert
License
TechnikEmpire/DivertPInvoke
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
PInvoke wrapper forWinDivert.
You may be interested in the fully-managed wrapper for WinDivert I've written, calledWinDivertSharp. It will be actively maintained, and this repository almost surely will not be.
Be mindful of the fact that the source file(s) in this repo are LGPLv3. Make sure you comply with this license (which is the same license as WinDivert).
This class will append two directories to the env vars of the executing application. It will appendEXE\x86
andEXE\x64
. This way, you can drop the WinDivert native executables in arch-specific directories next to your deployed application and keep using AnyCPU, and thanks to this little trick, the .NET assembly resolver will load the proper WinDivert native libraries.
Note that network to host and host to network order conversion is provided transparently by the structures defined here. In WinDivert, this is not the case obviously, but because we have the syntactic sugar to do this, it's done in this wrapper. For example, you can simply read or write theDstPort
of a TCP packet to80
likex.DstPort = 80
orx.DstPort == 80
, and all necessary order swapping is done under the hood.