Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FwpUClnt.FWPM_FILTER0.filterId is broken #475

Closed
Signum21 opened this issue Jul 30, 2024 · 1 comment
Closed

FwpUClnt.FWPM_FILTER0.filterId is broken #475

Signum21 opened this issue Jul 30, 2024 · 1 comment

Comments

@Signum21
Copy link

Describe the bug and how to reproduce

I'm enumerating the wfp filters.
The name, description and filterKey are correctly extracted but the filterId is 0 for all filters.

What code is involved

FwpUClnt.FwpmFilterEnum0(engineHandle, filterEnumHandle, 2500, out FwpUClnt.SafeFwpmMem filters, out uint filterslength);
FwpUClnt.FWPM_FILTER0[] filtersArray = filters.ToArray<FwpUClnt.FWPM_FILTER0>(filterslength, true);

foreach (FwpUClnt.FWPM_FILTER0 filter in filtersArray)
{
    Console.WriteLine(filter.displayData.name);
    Console.WriteLine(filter.displayData.description);
    Console.WriteLine(filter.filterId);
    Console.WriteLine(filter.filterKey + Environment.NewLine);
}

Expected behavior

The filterId should be different and not 0 (I confirmed this with another tool).

dahall added a commit that referenced this issue Jul 31, 2024
… a GetValue method to easier extract the value.
@dahall
Copy link
Owner

dahall commented Jul 31, 2024

Thanks. I had a size bug in FWP_VALUE0 causing the problem. It is fixed and can be found in 4.0.3 (soon to be released) or on the AppVeyor repository as pre-release (see readme).

I would strongly encourage the use of the overload for FwpmFilterEnum0 that tucks the array inside a memory manager.

FwpmFilterEnum0(engineHandle, out SafeFwpmArray<FWPM_FILTER0> h);
foreach (FWPM_FILTER0 e in h)
   ...

@dahall dahall closed this as completed Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants