Share via


GetIfTable2 (NETIOAPI) (Compact 7)

3/12/2014

This function retrieves the MIB-II interface table.

Syntax

NETIOAPI_API 
  GetIfTable2(
    OUT PMIB_IF_TABLE2*  Table
    );

Parameters

  • Table
    A pointer to a buffer that receives the table of interfaces in a MIB_IF_TABLE2 structure.

Return Value

GetIfTable2 returns STATUS_SUCCESS if the function succeeds.

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

Error Code Meaning

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 GetIfTable2 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, GetIfTable2Ex (NETIOAPI), 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.

GetIfTable2 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).

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)
GetIfTable2Ex (NETIOAPI)
MIB_IF_TABLE2
MIB_IF_ROW2