GetInterfaceInfo
Retrieves information about the network interfaces on the local computer.
Syntax
ULONG GetInterfaceInfo(
[out] PIP_INTERFACE_INFO pIfTable,
[in, out] PULONG Size
);
Parameters
Parameter | Description |
---|---|
pIfTable |
Pointer to a NULL -terminated array of IP_INTERFACE_INFO structures.
This array receives the interface information. The buffer must be large enough to
contain all the interface information.
|
Size |
On input, the size of the buffer pointed to by pIfTable , in bytes.
On output, if the function succeeds, this parameter is the size of the buffer
used to store the interface information. If the buffer is not large enough to
contain the returned interfaces, the function sets this parameter to the required
buffer size in bytes, and returns ERROR_INSUFFICIENT_BUFFER .
|
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.
Error Code | Description |
---|---|
ERROR_INSUFFICIENT_BUFFER |
The buffer pointed to by pIfTable is not large enough to hold the interface information. The required size is returned in the Size parameter. |
ERROR_INVALID_PARAMETER |
One or more parameters are invalid. |
ERROR_NOT_SUPPORTED |
The operating system does not support this function. |
Remarks
The GetInterfaceInfo
function retrieves a table of all network interfaces
on the local computer. This includes active interfaces, interfaces that are present but
not currently active, and interfaces that are hidden. The information returned includes
the interface's IP address, subnet mask, and the index of the interface.
The IP_INTERFACE_INFO
structure contains information about a single network interface,
including its description, IP address, and subnet mask.
To determine the correct buffer size required to receive all the interface information,
call GetInterfaceInfo
with a NULL
pointer for pIfTable
and 0 for the Size
parameter. The function will return the required buffer size
in the Size
parameter. Then, allocate a buffer of that size and call the function
again.
Important
This function is primarily used by applications that need to enumerate and query detailed information about network interfaces, such as network management tools or diagnostic utilities.
Requirements
Attribute | Value |
---|---|
Minimum supported client | Windows XP |
Minimum supported server | Windows Server 2003 |
Header | iphlpapi.h |
Library | Iphlpapi.lib |
DLL | Iphlpapi.dll |