dahall / Vanara

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

IpHlpApi.GetAdaptersAddresses() GatewayAddresses Member is always zero #472

Open shouhujishu opened 3 months ago

shouhujishu commented 3 months ago

IpHlpApi.GetAdaptersAddresses(Vanara.PInvoke.IpHlpApi.GetAdaptersAddressesFlags.GAA_FLAG_INCLUDE_ALL_INTERFACES); The gateway list is always zero when iterating over the results os: windows11 23H2 Thanks for the help

dahall commented 3 months ago

That is odd. I'm running the same OS ver and get a list of like 50 interfaces. Try some different flag values and see if the absence remains.

shouhujishu commented 3 months ago

That is odd. I'm running the same OS ver and get a list of like 50 interfaces. Try some different flag values and see if the absence remains.

Thank you for your reply. I have tried to switch different flags, and the result is normal. Only the GatewayAddresses enumeration is always empty.

dahall commented 2 months ago

Are you running your code as 32 or 64 bit? Can you try with second param as , ADDRESS_FAMILY.AF_UNSPEC?