Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GetAdaptersAddresses - How to get subnet mask?

962 views
Skip to first unread message

Jim Clark

unread,
Aug 11, 2009, 1:43:13 PM8/11/09
to
MSDN recommends using GetAdaptersAddresses instead of GetAdaptersInfo on
Windows XP and later. This is because it transparently supports IPv6.

It is quite straightfordward to get the current ip address(s) from the
FirstUnicastAddress linked list but I cannot see a way to get the IPv4
subnet mask. Is this possible with GetAdaptersAddresses?

Jim


Christian ASTOR

unread,
Aug 11, 2009, 5:13:33 PM8/11/09
to

With ConvertLengthToIpv4Mask() for OnLinkPrefixLength - inet_ntoa()
(Vista)

Jim Clark

unread,
Aug 12, 2009, 4:58:01 AM8/12/09
to
Thank you. This makes sense now.

Unfortunately my code needs to work on XP so it's back to using
GetAdaptersInfo. Shame that this obvious feature was only added in Vista!

Jim.


"Christian ASTOR" <cast...@club-internet.fr> wrote in message
news:d72ecbf1-8c8a-4c25...@z31g2000yqd.googlegroups.com...

0 new messages