title: Equivalent information from GetAdaptersAddresses() in Windows 2000 (WIN2KSP4)?
body: <p>I have a C++ (VS2005) application that makes use of <strong>GetAdaptersAddresses</strong>() on Windows XP and I need to provide most of the same information from IP_ADAPTER_ADDRESSES with regards to IPv4 (I don't need IPv6) in Windows 2000 (WIN2KSP4).</p>
  
  <p>(The IPv6 Technology Preview for Windows 2000 is not an option)</p>
  
  <p>Please remember when looking at MSDN, that under "Requirements" it should be
  "Minimum supported client : Windows 2000 Professional" (although, I do realize that MSDN isn't always correct*)</p>
  
  <p>The call to <strong>GetAdaptersAddresses</strong> looks like:</p>
  
  <pre><code>// flags = GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME
  GetAdaptersAddresses(AF_INET, flags, NULL, reinterpret_cast&lt;IP_ADAPTER_ADDRESSES*&gt;(info), &amp;actualSize)
  </code></pre>
  
  <p>The version of <strong>IP_ADAPTER_ADDRESSES</strong> that I have looks like:<br>
  (fields that are struck-through are not needed)</p>
  
  <pre><code>typedef struct _IP_ADAPTER_ADDRESSES {
    union {
      ULONGLONG Alignment;
      struct {
        ULONG Length;
        DWORD IfIndex;
      } ;
    } ;
    struct _IP_ADAPTER_ADDRESSES *Next;
    PCHAR                              AdapterName;
    PIP_ADAPTER_UNICAST_ADDRESS        FirstUnicastAddress;
    PIP_ADAPTER_ANYCAST_ADDRESS        FirstAnycastAddress;
    PIP_ADAPTER_MULTICAST_ADDRESS      FirstMulticastAddress;
    PIP_ADAPTER_DNS_SERVER_ADDRESS     FirstDnsServerAddress;
    PWCHAR                             DnsSuffix;
    PWCHAR                             Description;
    PWCHAR                             FriendlyName;
    BYTE                               PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
    DWORD                              PhysicalAddressLength;
    DWORD                              Flags;
    DWORD                              Mtu;
    DWORD                              IfType;
    IF_OPER_STATUS                     OperStatus;
    DWORD                              Ipv6IfIndex;
    DWORD                              ZoneIndices[16];
    PIP_ADAPTER_PREFIX                 FirstPrefix;
  } IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES;
  </code></pre>
  
  <p>Through a combination of calls to:  </p>
  
  <pre><code>  GetIpAddrTable       (MIB_IPADDRTABLE, MIB_IPADDRROW)  
    GetAdaptersInfo      (IP_ADAPTER_INFO)  
    GetIfTable           (MIB_IFTABLE, MIB_IFROW)  
    GetIfEntry           (MIB_IFROW)  
  </code></pre>
  
  <p>I can get some of the information I need:  </p>
  
  <pre><code>  AdapterName
    FirstUnicastAddress   // I think I have this
    PhysicalAddress          // MAC address
    PhysicalAddressLength
    Flags
    Mtu                      // only available from MIB_IFROW
    IfType
  </code></pre>
  
  <p>That leaves me my problem, and 3 questions:  </p>
  
  <p>1) IF_OPER_STATUS OperStatus != dwOperStatus from MIB_IFROW<br>
  Anyone have thoughts on how to get the equivelent information or something close to it?</p>
  
  <p>2) I believe that I have found the equivelent to FirstUnicastAddress with IP_ADDR_STRING IpAddressList from IP_ADAPTER_INFO.  Assuming that I am correct (am I?), how might I determine that the addresses are in the same order; that the first address from FirstUnicastAddress is the same as the the first address in IpAddressList?  And yes, it would be usefult to transverse the list if there is more than one address in the list.</p>
  
  <p>3) FirstMulticastAddress : Getting this information has been made harder by my limited knowledge of multicasting.
   I had thought that using WSAIoctl with SIO_GET_INTERFACE_LIST would lead me to an answer, but no.  Lately I've
   been trying to use getsockopt with IP_MULTICAST_IF.  So far, I'm only managing to get 4 bytes returned with  ip_mreq.imr_multiaddr set to 0.0.0.0.  I'm hoping it's user error on my part since GetAdaptersAddresses returns
   2 addresses for my network card and 1 address for loopback.  So, how do I get all the multicast addresses
   associated with each interface?  And if I do get the getsockopt call working, how do I get more than 1 multicast
   address from it?</p>
  
  <p>Thanks,</p>
  
  <p>Bill</p>
  
  <ul>
  <li>Regarding the MSDN doc for ip_mreq at <a href="http://msdn.microsoft.com/en-us/library/ms738695%28VS.85%29.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms738695%28VS.85%29.aspx</a>, it lists Minimum supported client as Windows XP.  Yet I found this nice little KB article  support.microsoft.com/kb/131978</li>
  </ul>