GetAdaptersAddresses function (iphelper.h)
Retrieves the adapter address structures for all network adapters on the local computer.
PULONG GetAdaptersAddresses(
_In_ ULONG Family,
_In_ ULONG Flags,
_In_ PVOID pReserved,
_Inout_ PIP_ADAPTER_ADDRESSES pAdapterAddresses,
_Inout_ PULONG pOutBufLen
);
| Parameter | Description |
|---|---|
Family |
The address family for which to retrieve adapter information. Possible values are:
|
Flags |
Flags that specify how to retrieve adapter information. This parameter can be zero or one or more of the following values:
|
pReserved |
Reserved for future use. Must be NULL. |
pAdapterAddresses |
A pointer to a buffer that will receive an array of IP_ADAPTER_ADDRESSES structures.
If the buffer is not large enough, the function returns ERROR_BUFFER_OVERFLOW and sets the pOutBufLen parameter to the required buffer size.
|
pOutBufLen |
On input, the size of the buffer pointed to by pAdapterAddresses, in bytes.
On output, if the buffer is not large enough, this parameter receives the required buffer size in bytes.
|
If the function succeeds, the return value is NO_ERROR.
If the buffer pointed to by pAdapterAddresses is not large enough to contain the adapter information, the function returns ERROR_BUFFER_OVERFLOW and the value pointed to by the pOutBufLen parameter is set to the required buffer size.
If the function fails, the return value is one of the following error codes:
ERROR_INVALID_PARAMETER: An invalid parameter was passed to the function.ERROR_NOT_FOUND: No adapter addresses were found.- Other system error codes.
This function is used to retrieve information about network adapters on the local computer.
The caller must initialize the pOutBufLen parameter to the size of the buffer pointed to by pAdapterAddresses.
The returned adapter address structures are linked together in a linked list through their Next members.
For a detailed example of using this function, see the Network Sample Code.
| Requirement | Value |
|---|---|
| Minimum supported client | Windows Vista [desktop apps only] |
| Minimum supported server | Windows Server 2008 [desktop apps only] |
| Target Platform | Windows |
| Header | iphelper.h |
| Library | Iphlpapi.lib |
| DLL | Iphlpapi.dll |