GetIfEntry2Ex function (netioapi.h)

The GetIfEntry2Ex function retrieves the specified level of information for the specified interface on the local computer.

Syntax

IPHLPAPI_DLL_LINKAGE _NETIOAPI_SUCCESS_ NETIOAPI_API GetIfEntry2Ex(
  [in]      MIB_IF_ENTRY_LEVEL Level,
  [in, out] PMIB_IF_ROW2       Row
);

Parameters

[in] Level

The level of interface information to retrieve. This parameter can be one of the values from the MIB_IF_ENTRY_LEVEL enumeration type defined in the Netioapi.h header file.

Value Meaning
MibIfEntryNormal
0
The values of statistics and state returned in members of the MIB_IF_ROW2 structure pointed to by the Row parameter are returned from the top of the filter stack.
MibIfEntryNormalWithoutStatistics
2
The values of state (without statistics) returned in members of the MIB_IF_ROW2 structure pointed to by the Row parameter are returned from the top of the filter stack.

[in, out] Row

A pointer to a MIB_IF_ROW2 structure that, on successful return, receives information for an interface on the local computer. On input, the InterfaceLuid or the InterfaceIndex member of the MIB_IF_ROW2 must be set to the interface for which to retrieve information.

Return value

If the function succeeds, the return value is NO_ERROR.

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

Return code Description
ERROR_FILE_NOT_FOUND
The system cannot find the file specified. This error is returned if the network interface LUID or interface index specified by the InterfaceLuid or InterfaceIndex member of the MIB_IF_ROW2 pointed to by the Row parameter was not a value on the local machine.
ERROR_INVALID_PARAMETER
An invalid parameter was passed to the function. This error is returned if a NULL parameter is passed in the Row parameter. This error is also returned if the both the InterfaceLuid and InterfaceIndex member of the MIB_IF_ROW2 pointed to by the Row parameter are unspecified.
Other
Use the FormatMessage function to obtain the message string for the returned error.

Remarks

The
GetIfEntry2Ex function retrieves information for a specified interface on a local system and returns this information in a pointer to a
MIB_IF_ROW2 structure. GetIfEntry2Ex is an enhanced version of the GetIfEntry2 function that allows selecting the level of interface information to retrieve.

On input, at least one of the following members in the MIB_IF_ROW2 structure passed in the Row parameter must be initialized: InterfaceLuid or InterfaceIndex.

The fields are used in the order listed above. So if the InterfaceLuid is specified, then this member is used to determine the interface. If no value was set for the InterfaceLuid member (the value of this member was set to zero), then the InterfaceIndex member is next used to determine the interface.

On output, the remaining fields of the MIB_IF_ROW2 structure pointed to by the Row parameter are filled in.

Note that the Netioapi.h header file is automatically included in Iphlpapi.h header file, and should never be used directly.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1703 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header netioapi.h (include Iphlpapi.h)
Library Iphlpapi.lib
DLL Iphlpapi.dll

See also

GetIfEntry

GetIfEntry2

GetIfTable

GetIfTable2

GetIfTable2Ex

IP Helper Function Reference

MIB_IFROW

MIB_IFTABLE

MIB_IF_ROW2

MIB_IF_TABLE2