Export (0) Print
Expand All
Expand Minimize

GetIfTable2 function

The GetIfTable2 function retrieves the MIB-II interface table.

Syntax


NETIOAPI_API GetIfTable2(
  _Out_  PMIB_IF_TABLE2 *Table
);

Parameters

Table [out]

A pointer to a buffer that receives the table of interfaces in a MIB_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_NOT_ENOUGH_MEMORY

Insufficient memory resources are available to complete the operation.

Other

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

 

Remarks

The GetIfTable2 function enumerates the logical and physical interfaces on a local system and returns this information in a MIB_IF_TABLE2 structure. GetIfTable2 is an enhanced version of the GetIfTable function.

A similar GetIfTable2Ex function can be used to specify the level of interfaces to return. Calling the GetIfTable2Ex function with the Level parameter set to MibIfTableNormal retrieves the same results as calling the GetIfTable2 function.

Interfaces are returned in a MIB_IF_TABLE2 structure in the buffer pointed to by the Table parameter. The MIB_IF_TABLE2 structure contains an interface count and an array of MIB_IF_ROW2 structures for each interface. Memory is allocated by the GetIfTable2 function for the MIB_IF_TABLE2 structure and the MIB_IF_ROW2 entries in this structure. When these returned structures are no longer required, free the memory by calling the FreeMibTable.

Note that the returned MIB_IF_TABLE2 structure pointed to by the Table parameter may 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 may also be present between the MIB_IF_ROW2 array entries. Any access to a MIB_IF_ROW2 array entry should assume padding may exist.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Netioapi.h (include Iphlpapi.h)

Library

Iphlpapi.lib

DLL

Iphlpapi.dll

See also

FreeMibTable
GetIfTable
GetIfTable2Ex
IP Helper Function Reference
MIB_IF_TABLE2
MIB_IF_ROW2

 

 

Community Additions

ADD
Show:
© 2014 Microsoft