Partager via


GetAdaptersAddresses (Windows Embedded CE 6.0)

1/6/2010

This function retrieves the addresses associated with the adapters on the local computer.

Syntax

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 Value

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.

Remarks

The information returned by this function includes information for IPv6 interfaces.

Requirements

Header iphlpapi.h
Library Iphlpapi.lib
Windows Embedded CE Windows CE .NET 4.1 and later

See Also

Reference

IP Helper Functions
IP_ADAPTER_ADDRESSES