dahall / Vanara

A set of .NET libraries for Windows implementing PInvoke calls to many native Windows APIs with supporting wrappers.
MIT License
1.75k stars 190 forks source link

Missing unions in FwpUClnt FWPM_* structures #445

Closed jcspencer closed 3 months ago

jcspencer commented 4 months ago

Describe the bug and how to reproduce

Hi!

First of all - thank you for building Vanara - this library is an absolute lifesaver!

I am currently working with the Windows Filtering Platform using RPC Filters. Specifically, adding filters using the FwpUClnt PInvoke library.

A number of structures in this subsystem have union field types, and some are missing in Vanara. This means the structures are larger than they are supposed to be, and causes issues inside WFP when it attempts to parse the structures that Vanara creates.

What code is involved

In FWPM_FILTER0:

In FWPM_ACTION0:

I may have missed others, but these are the first two that are obvious to me.

Expected behavior

When creating an new FWPM_FILTER0 and passing it to FwpmFilterAdd0(), the library is unable to parse the structure.

See this Sample Code for an example that fails.

Initializing this class with dynamic=true should be enough to trigger the failure.

Thanks!

dahall commented 3 months ago

Sorry I missed those. They are now fixed in the nullable branch and will get released with the 4.0 packages.