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
);
Parameters
- Family
- [in] The address family of the addresses to retrieve. The following table shows the possible values for this parameter.
| Value | Description |
| AF_INET | Return only IPv4 addresses. |
| AF_INET6 | Return only IPv6 addresses. |
| AF_UNSPEC | Return addresses from all address families. |
- Flags
- [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.
| Value | Description |
| GAA_FLAG_INCLUDE_PREFIX | Return the IPv6 address prefix. |
| GAA_FLAG_SKIP_UNICAST | Do not return unicast addresses. |
| GAA_FLAG_SKIP_ANYCAST | Do not return anycast addresses. |
| GAA_FLAG_SKIP_FRIENDLY_NAME | Do not return the adapter's friendly name. |
| GAA_FLAG_SKIP_MULTICAST | Do not return multicast addresses. |
| GAA_FLAG_SKIP_DNS_SERVER | Do not return addresses of DNS servers. |
- Reserved
- [in] Reserved.
- pAdapterAddresses
- [out] Pointer to an IP_ADAPTER_ADDRESSES structure containing information about the adapter addresses.
- pOutBufLen
- [in, out] Pointer to the size, in bytes, of the buffer indicated by pAdapterAddresses.
Remarks
The information returned by this function includes information for IPv6 interfaces.
Return Values
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.
ERROR_INVALID_PARAMETER - user passed in a NULL or an invalid pointer for one or more of the OUT parameters.
For a complete list of error codes, see Error Values or the SDK header file Winerror.h.
Requirements
OS Versions: Windows CE .NET 4.1 and later.
Header: Iphlpapi.h.
Link Library: Iphlpapi.lib.
See Also
IP Helper Functions | IP_ADAPTER_ADDRESSES
Send Feedback on this topic to the authors
Feedback FAQs