This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
TheGetIfTable2Ex function retrieves the MIB-II interface table.
IPHLPAPI_DLL_LINKAGE _NETIOAPI_SUCCESS_ NETIOAPI_API GetIfTable2Ex( [in] MIB_IF_TABLE_LEVEL Level, [out] PMIB_IF_TABLE2 *Table);[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.
| Value | Meaning |
|---|---|
| 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. |
| 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.
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 |
|---|---|
| An invalid parameter was passed to the function. This error is returned if an illegal value was passed in theLevel parameter. |
| Insufficient memory resources are available to complete the operation. |
| UseFormatMessage to obtain the message string for the returned error. |
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.
| Requirement | Value |
|---|---|
| Minimum supported client | Windows Vista [desktop apps only] |
| Minimum supported server | Windows Server 2008 [desktop apps only] |
| Target Platform | Windows |
| Header | netioapi.h (include Iphlpapi.h) |
| Library | Iphlpapi.lib |
| DLL | Iphlpapi.dll |
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Want to try using Ask Learn to clarify or guide you through this topic?