Hi everyone,
So, I want to keep an up-to-date list of the machine’s ip address(es) and subnet mask(s) in my driver - without having it passed down from user-mode. But I’m having problems tracking down how to do this in Vista etc using the ip helper api (which I understand is recommended for the future). Can anyone advise me here?
OK, background.
The driver registers for callbacks (TdiRegisterPnPHandlers pre-Vista, NotifyUnicastIpAddressChange Vista & on), and these do indeed seem to fire on an ip address change or submask change. Great.
(as an aside: *is* there a mechanism for changing the submask without these firing? I haven’t found one yet, but…)
Pre-Vista, the callback provides only the ip address, but the submask can be retrieved using IOCTL_TCP_QUERY_INFORMATION_EX (*).
Vista and onwards, I have been looking at the docs and really I’m not sure - *is* the submask provided in the context of the callback? I thought that
Row->OnLinkPrefixLength
might be it, but I’ve never seen it with a valid value.
Interestingly even in W7 I can still dig out the right submask value using IOCTL_TCP_QUERY_INFORMATION_EX. So it’s not like the OS doesn’t have that info at that point.
Well, that’s it pretty much. Any advice welcomed.
MH
(*) should be done in a work item due to IRQL requirements