Export (0) Print
Expand All
Expand Minimize

GetAdapterIndex function

The GetAdapterIndex function obtains the index of an adapter, given its name.

Syntax


DWORD GetAdapterIndex(
  _In_     LPWSTR AdapterName,
  _Inout_  PULONG IfIndex
);

Parameters

AdapterName [in]

A pointer to a Unicode string that specifies the name of the adapter.

IfIndex [in, out]

A pointer to a ULONG variable that points to the index of the adapter.

Return value

If the function succeeds, the return value is NO_ERROR.

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

Remarks

Until an adapter is fully disabled, the GetAdapterIndex function reports the adapter as present. For example, the NotifyAddrChange function may indicate a recently disabled adapter's IP address is removed, but GetAdapterIndex continues to report an adapter index until the process of disabling the adapter is complete.

When one or more adapters are present on the system, GetAdapterIndex returns ERROR_DEV_NOT_EXIST when the adapter being queried does not exist. When no adapters are present, the GetAdapterIndex function returns ERROR_NO_DATA.

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

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Iphlpapi.h

Library

Iphlpapi.lib

DLL

Iphlpapi.dll

See also

IP Helper Start Page
IP Helper Function Reference
GetAdaptersInfo
IP_ADAPTER_INFO
MprConfigGetFriendlyName
MprConfigGetGuidName
NotifyAddrChange

 

 

Community Additions

ADD
Show:
© 2014 Microsoft