Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

GetIfTable2Ex function (netioapi.h)

Feedback

In this article

TheGetIfTable2Ex function retrieves the MIB-II interface table.

Syntax

IPHLPAPI_DLL_LINKAGE _NETIOAPI_SUCCESS_ NETIOAPI_API GetIfTable2Ex(  [in]  MIB_IF_TABLE_LEVEL Level,  [out] PMIB_IF_TABLE2     *Table);

Parameters

[in] Level

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

ValueMeaning
MibIfTableNormal
The values of statistics and state returned in members of theMIB_IF_ROW2 structure in theMIB_IF_TABLE2 structure pointed to by theTable parameter are returned from the top of the filter stack when this parameter is specified.
MibIfTableRaw
The values of statistics and state returned in members of theMIB_IF_ROW2 structure in theMIB_IF_TABLE2 structure pointed to by theTable parameter are returned directly for the interface being queried.

[out] Table

A pointer to a buffer that receives the table of interfaces in aMIB_IF_TABLE2 structure.

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 codeDescription
ERROR_INVALID_PARAMETER
An invalid parameter was passed to the function. This error is returned if an illegal value was passed in theLevel parameter.
ERROR_NOT_ENOUGH_MEMORY
Insufficient memory resources are available to complete the operation.
Other
UseFormatMessage to obtain the message string for the returned error.

Remarks

The
GetIfTable2Ex function enumerates the logical and physical interfaces on a local system and returns this information in aMIB_IF_TABLE2 structure.GetIfTable2Ex is an enhanced version of theGetIfTable function that allows selecting the level of interface information to retrieve.

A similarGetIfTable2 function can also be used to retrieve interfaces. but does not allow specifying the level of interfaces to return. Calling theGetIfTable2Ex function with theLevel parameter set toMibIfTableNormal retrieves the same results as calling theGetIfTable2 function.

Interfaces are returned in aMIB_IF_TABLE2 structure in the buffer pointed to by theTable parameter. TheMIB_IF_TABLE2 structure contains an interface count and an array ofMIB_IF_ROW2 structures for each interface. Memory is allocated by theGetIfTable2 function for theMIB_IF_TABLE2 structure and theMIB_IF_ROW2 entries in this structure. When these returned structures are no longer required, free the memory by calling theFreeMibTable.

All interfaces including NDIS intermediate driver interfaces and NDIS filter driver interfaces are returned for either of the possible values for theLevel parameter. The setting for theLevel parameter affects how statistics and state members of theMIB_IF_ROW2 structure in theMIB_IF_TABLE2 structure pointed to by theTable parameter for the interface are returned. For example, a network interface card (NIC) will have a NDIS miniport driver. An NDIS intermediate driver can be installed to interface between upper-level protocol drivers and NDIS miniport drivers. An NDIS filter driver (LWF) can be attached on top of the NDIS intermediate driver. Assume that the NIC reports the MediaConnectState member of theMIB_IF_ROW2 structure asMediaConnectStateConnected but NDIS filter driver modifies the state and reports the state asMediaConnectStateDisconnected.When the interface information is queried withLevel parameter set toMibIfTableNormal, the state at the top of the filter stack, that isMediaConnectStateDisconnected is reported. When the interface is queried with theLevel parameter set toMibIfTableRaw, the state at the interface level directly, that isMediaConnectStateConnected is returned.

Note that the returnedMIB_IF_TABLE2 structure pointed to by theTable parameter may contain padding for alignment between theNumEntries member and the firstMIB_IF_ROW2 array entry in theTable member of theMIB_IF_TABLE2 structure. Padding for alignment may also be present between theMIB_IF_ROW2 array entries. Any access to aMIB_IF_ROW2 array entry should assume padding may exist.

Requirements

RequirementValue
Minimum supported clientWindows Vista [desktop apps only]
Minimum supported serverWindows Server 2008 [desktop apps only]
Target PlatformWindows
Headernetioapi.h (include Iphlpapi.h)
LibraryIphlpapi.lib
DLLIphlpapi.dll

See also

FreeMibTable

GetIfTable

GetIfTable2

IP Helper Function Reference

MIB_IF_ROW2

MIB_IF_TABLE2


Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

  • Last updated on

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?