Compartilhar via


GetIfTable2Ex (NETIOAPI) (Compact 2013)

3/26/2014

This function retrieves the MIB-II interface table, given a level of interface information to retrieve.

Syntax

NETIOAPI_API
  GetIfTable2Ex(
    IN MIB_IF_TABLE_LEVEL  Level,
    OUT PMIB_IF_TABLE2*  Table
    );

Parameters

  • Level
    The level of interface information to retrieve. This parameter can be one of the values from the MIB_IF_TABLE_LEVEL enumeration.
  • Table
    A pointer to a buffer that receives the table of interfaces in a MIB_IF_TABLE2 structure.

Return Value

GetIfTable2Ex returns STATUS_SUCCESS if the function succeeds.

If the function fails, GetIfTable2Ex returns one of the following error codes:

Error Code

Meaning

STATUS_INVALID_PARAMETER

An invalid parameter was passed to the function. This error is returned if an illegal value was passed in the Level parameter.

STATUS_NOT_ENOUGH_MEMORY

Insufficient memory resources are available to complete the operation.

Other

Use the FormatMessage function to obtain the message string for the returned error.

Remarks

The GetIfTable2Ex function enumerates the logical and physical interfaces on a local device and returns this information in a MIB_IF_TABLE2 structure.

Your driver can use a similar function, GetIfTable2 (NETIOAPI), to retrieve interfaces, but GetIfTable2 does not enable your driver to specify the level of interfaces to return. A call to the GetIfTable2Ex function that has the Level parameter set to MibIfTableNormal retrieves the same results as calling the GetIfTable2 function.

GetIfTable2Ex returns interfaces in a MIB_IF_TABLE2 structure in the buffer that the Table parameter points to. The MIB_IF_TABLE2 structure contains an interface count and an array of MIB_IF_ROW2 structures for each interface. GetIfTable2 allocates memory for the MIB_IF_TABLE2 structure and the MIB_IF_ROW2 entries in this structure. When these returned structures are no longer required, your driver should free the memory by calling the FreeMibTable (NETIOAPI).

All interfaces. These included NDIS intermediate driver interfaces and NDIS filter driver interfaces, are returned for either of the possible values for the Level parameter. The setting for the Level parameter affects how statistics and state members of the MIB_IF_ROW2 structure in the MIB_IF_TABLE2 structure that is pointed to by the Table parameter for the interface are returned. For example, a network adapter (NIC) has 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 the MIB_IF_ROW2 structure as MediaConnectStateConnected, but the NDIS filter driver modifies the state and reports the state as MediaConnectStateDisconnected. When the interface information is queried with Level parameter set to MibIfTableNormal, the state at the top of the filter stack (MediaConnectStateDisconnected) is reported. When the interface is queried with the Level parameter set to MibIfTableRaw, the state at the interface level directly (MediaConnectStateConnected) is returned.

Note that the returned MIB_IF_TABLE2 structure that the Table parameter points to might contain padding for alignment between the NumEntries member and the first MIB_IF_ROW2 array entry in the Table member of the MIB_IF_TABLE2 structure. Padding for alignment might also be present between the MIB_IF_ROW2 array entries. Any access to a MIB_IF_ROW2 array entry should assume padding may exist.

See Also

Reference

IP Helper Kernel-Mode Functions
FreeMibTable (NETIOAPI)
GetIfTable2 (NETIOAPI)
MIB_IF_TABLE_LEVEL
MIB_IF_TABLE2
MIB_IF_ROW2