Platform SDK: Internet Protocol Helper

GetAdaptersInfo

The GetAdaptersInfo function retrieves adapter information for the local computer.

DWORD GetAdaptersInfo(
  PIP_ADAPTER_INFO pAdapterInfo,    // buffer to receive data
  PULONG pOutBufLen                 // size of data returned
);

Parameters

pAdapterInfo
Pointer to a buffer that, on successful return, receives a linked list of IP_ADAPTER_INFO structures.
pOutBufLen
Pointer to a ULONG variable that contains the size of the buffer pointed to by the pAdapterInfo parameter. If this size is insufficient to hold the adapter information, GetAdaptersInfo fills in this variable with the required size, and returns an error code of ERROR_BUFFER_OVERFLOW.

Return Values

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is one of the following error codes.

Value Meaning
ERROR_BUFFER_OVERFLOW The buffer size indicated by the pOutBufLen parameter is too small to hold the adapter information. The pOutBufLen parameter points to the required size.
ERROR_INVALID_PARAMETER The pOutBufLen parameter is NULL, or 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 the pAdapterInfo parameter.
ERROR_NO_DATA No adapter information exists for the local computer.
ERROR_NOT_SUPPORTED GetAdaptersInfo is not supported by the operating system running on the local computer.
Other If the function fails, use FormatMessage to obtain the message string for the returned error.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 98.
  Header: Declared in Iphlpapi.h.
  Library: Use Iphlpapi.lib.

See Also

IP_ADAPTER_INFO