title: Get an IP_ADDRESS_STRING from GetAdaptersAddresses()?
body: <p><a href="http://msdn.microsoft.com/en-us/library/aa365915%28v=VS.85%29.aspx" rel="noreferrer">GetAdaptersAddresses()</a> will get you addresses in IP_ADAPTER_UNICAST_ADDRESS format, which is defined as:</p>
  
  <pre><code>typedef struct _IP_ADAPTER_UNICAST_ADDRESS {
    union {
      struct {
        ULONG Length;
        DWORD Flags;
      } ;
    } ;
    struct _IP_ADAPTER_UNICAST_ADDRESS *Next;
    SOCKET_ADDRESS                     Address;
    IP_PREFIX_ORIGIN                   PrefixOrigin;
    IP_SUFFIX_ORIGIN                   SuffixOrigin;
    IP_DAD_STATE                       DadState;
    ULONG                              ValidLifetime;
    ULONG                              PreferredLifetime;
    ULONG                              LeaseLifetime;
    UINT8                              OnLinkPrefixLength;
  } IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS;
  </code></pre>
  
  <p>The only field that seems to suggest the human-readable IP address string is Address, which is a SOCKET_ADDRESS structure defined as:</p>
  
  <pre><code>typedef struct _SOCKET_ADDRESS {
    LPSOCKADDR lpSockaddr;
    INT        iSockaddrLength;
  } SOCKET_ADDRESS, *PSOCKET_ADDRESS;
  </code></pre>
  
  <p>Which, in turn, uses another structure, SOCKADDR, defined as:</p>
  
  <p>Sorry, it's way to complex to post here, as it varies depending on IPv4 vs. IPv6 and the Windows edition... so here is a link to the definition:</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/ms740496%28v=VS.85%29.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms740496%28v=VS.85%29.aspx</a></p>
  
  <p>If you haven't gotten dizzy yet like I did and followed through this maze of definitions, you probably noticed that it's a nightmare to retrieve the good old dotted string style of an IP address, as it used to be much easier using <a href="http://msdn.microsoft.com/en-us/library/aa365917%28VS.85%29.aspx" rel="noreferrer">GetAdaptersInfo()</a>.</p>
  
  <p>My question is: Is there a <em>truly</em> IP Helper function that can convert IP_ADAPTER_UNICAST_ADDRESS to an IPv4 dotted string (or an IPv6 string)?</p>