IPv6 properties on Windows
Hi,
I am trying to write a program to retrieve IPv6 address, IPv6 Gateway and IPv6 prefix length through a C++ program. I have 2 similar programs for IPv4 properties. The first program for IPv4 uses Win API 'GetAdapterAddresses' to retrieve these properties, while the other program retrieves the properties for a given interface using Windows Registry.
However, for IPv6 configuration, I did not find equivalent registry keys to retrieve above mentioned properties. I found out that 'GetAdapterAddresses' can be used for this purpose. But the structures returned by 'GetAdapterAddresses' have limited information on Windows 2003 machines. e.g. I can retrieve prefix length and gateway on 2008/vista, but these are not returned on 2003/XP.
Please help me understand
1. If there are any Windows registry keys across all windows flavors which can give me this information?
2. If there is any way using Windows API to retrieve gateway and prefix on 2003/XP machines?
Thanks in advance for your help. Appreciate it !
December 7th, 2009 1:03pm
Hi Dhirajmundada,Thank you for posting in windows server forums, The below value can be retrieved on windows xp sp1, so it will return even on windows 2003 code base. You need to include iptypes.h
GAA_FLAG_INCLUDE_PREFIX
Return a list of IP address prefixes on this adapter. When this flag is set,IP address prefixes are returned for both IPv6 and IPv4 addresses. This flag is supported on Windows XP with SP1 and later.
And you are correct for retreiving gateway the API is not supported GetAdaptersInfo is used for windows xp , and GetAdaptersAddresses is supported from vista on wards. =======================================================================From Registry you could use the below key HKLM\system\CCS\services\Tcpip\parameters\interfaces\ <interface GUID > which will give desired data.
Free Windows Admin Tool Kit Click here and download it now
December 26th, 2009 3:24am


