This function retrieves the addresses associated with the adapters on the local computer.
DWORD WINAPI GetAdaptersAddresses( ULONG Family, DWORD Flags, PVOID Reserved, PIP_ADAPTER_ADDRESSES pAdapterAddresses, PULONG pOutBufLen );
[in] The address family of the addresses to retrieve. The following table shows the possible values for this parameter.
Return only IPv4 addresses.
Return only IPv6 addresses.
Return addresses from all address families.
[in] The type of the addresses to retrieve. The following table shows the possible values. This parameter is zero or a combination of these values.
Return the IPv6 address prefix.
Do not return unicast addresses.
Do not return anycast addresses.
Do not return the adapter's friendly name.
Do not return multicast addresses.
Do not return addresses of DNS servers.
[out] Pointer to an IP_ADAPTER_ADDRESSES structure containing information about the adapter addresses.
[in, out] Pointer to the size, in bytes, of the buffer indicated by pAdapterAddresses.
The following are the errors that GetAdaptersAddresses function returns:
ERROR_SUCCESS - call was successful and results are in the provided buffer.
ERROR_NO_DATA - call was successful but there was no data to return.
ERROR_BUFFER_OVERFLOW - call failed because the buffer was too small for the data to be returned. When this error is returned, the value pointed to by pOutBufLen (if non-NULL) is set to contain the required number of bytes in pAdapterAddresses for the call to succeed. The caller is expected to allocate the buffer with the required size and call the function again to obtain the data.
ERROR_INVALID_PARAMETER - user passed in a NULL or an invalid pointer for one or more of the OUT parameters. The calling process does not have read/write access to the memory pointed to by pOutBufLen or the calling process does not have write access to the memory pointed to by pAdapterAddresses.
For a complete list of error codes, see Error Values or the SDK header file Winerror.h.