GetAdapterAddresses Function
Syntax
_Inout_ ULONG SizePointer,
_In_ ULONG Flags
For Windows Vista and later, the function signature is:
_Inout_ ULONG SizePointer,
_In_ ULONG Flags
Parameters
Parameter | Description |
---|---|
AdapterAddresses |
On input, a pointer to a buffer that is large enough to receive the adapter address structures. On output, a pointer to the first If this parameter is |
SizePointer |
On input, a pointer to a On output, if the function succeeds and |
Flags |
A set of flags that specify how adapter addresses are retrieved. This parameter can be one or more of the following values:
|
Remarks
This function is used to retrieve information about network interfaces. The information is returned as a linked list of IP_ADAPTER_ADDRESSES
structures. Each structure in the list represents a network interface on the local computer.
The adapter addresses retrieved include IPv4 and IPv6 addresses, MAC addresses, and gateway information.
When calling this function, you should first call it with AdapterAddresses
set to NULL
and SizePointer
set to 0
. This will return the required buffer size in the SizePointer
parameter. You then allocate a buffer of that size and call the function again with the allocated buffer.
GetAdaptersAddresses
function rather than the older GetAdaptersInfo
function. GetAdaptersAddresses
provides more comprehensive information and supports IPv6 addresses.
Return Value
If the function succeeds, the return value is ERROR_SUCCESS
. If the buffer pointed to by the AdapterAddresses
parameter is not large enough to hold the adapter data, the return value is ERROR_BUFFER_OVERFLOW
and the required buffer size is returned in the SizePointer
parameter.
If the function fails, the return value can be one of the following error codes:
Return Code | Description |
---|---|
ERROR_INVALID_PARAMETER |
One or more parameters are invalid. |
ERROR_NOT_SUPPORTED |
The requested operation is not supported. |
ERROR_NO_DATA |
No adapter addresses were found. |
Requirements
Header | Iphlpapi.h |
---|---|
Library | Iphlpapi.lib |
DLL | Iphlpapi.dll |
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
See Also
Network Management Functions