次の方法で共有


GetPerAdapterInfo (Compact 2013)

3/26/2014

This function retrieves information about the adapter that corresponds to the specified interface.

Syntax

DWORD GetPerAdapterInfo( 
  ULONG IfIndex, 
  PIP_PER_ADAPTER_INFO pPerAdapterInfo, 
  PULONG pOutBufLen 
);

Parameters

  • IfIndex
    [in] The index of an interface for which to retrieve adapter information.
  • pPerAdapterInfo
    [out] Pointer to an IP_PER_ADAPTER_INFO structure that contains information about the adapter.
  • pOutBufLen
    [in, out] Pointer to a ULONG variable that specifies the size of the IP_PER_ADAPTER_INFO structure. If this size is insufficient to hold the information, GetPerAdapterInfo fills in this variable with the required size, and returns an error code of ERROR_BUFFER_OVERFLOW.

Return Value

If the function succeeds, the return value is ERROR_SUCCESS.

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

Return code

Description

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 permission 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_NOT_SUPPORTED

GetPerAdapterInfo is not supported by the operating system that is running on the local device.

Other

If the function fails, use FormatMessage to obtain the message string for the returned error.

Remarks

An adapter index may change when the adapter is disabled and then enabled, or under other circumstances, and should not be considered persistent.

Requirements

Header

iphlpapi.h

Library

Iphlpapi.lib

See Also

Reference

IP Helper Functions
IP_PER_ADAPTER_INFO

Other Resources

IP Helper