GetIpNetTable function (iphlpapi.h)
The GetIpNetTable function retrieves the IPv4 to physical address mapping table.
IPHLPAPI_DLL_LINKAGE ULONG GetIpNetTable(
[out] PMIB_IPNETTABLE IpNetTable,
[in, out] PULONG SizePointer,
[in] BOOL Order
);
[out] IpNetTable
A pointer to a buffer that receives the IPv4 to physical address mapping table as a MIB_IPNETTABLE structure.
[in, out] SizePointer
On input, specifies the size in bytes of the buffer pointed to by the pIpNetTable parameter.
On output, if the buffer is not large enough to hold the returned mapping table, the function sets this parameter equal to the required buffer size in bytes.
[in] Order
A Boolean value that specifies whether the returned mapping table should be sorted in ascending order by IP address. If this parameter is TRUE, the table is sorted.
If the function succeeds, the return value is NO_ERROR or ERROR_NO_DATA.
If the function fails or does not return any data, the return value is one of the following error codes.
Return code | Description |
---|---|
|
The buffer pointed to by the pIpNetTable parameter is not large enough. The required size is returned in the DWORD variable pointed to by the pdwSize parameter. |
|
An invalid parameter was passed to the function. This error is returned if the pdwSize parameter is NULL, or GetIpNetTable is unable to write to the memory pointed to by the pdwSize parameter. |
|
There is no data to return. The IPv4 to physical address mapping table is empty. This return value indicates that the call to the GetIpNetTable function succeeded, but there was no data to return. |
|
The IPv4 transport is not configured on the local computer. |
|
Use FormatMessage to obtain the message string for the returned error. |
The
GetIpNetTable function enumerates the Address Resolution Protocol (ARP) entries for IPv4 on a local system from the IPv4 to physical address mapping table and returns this information in a MIB_IPNETTABLE structure.
The IPv4 address entries are returned in a MIB_IPNETTABLE structure in the buffer pointed to by the pIpNetTable parameter. The MIB_IPNETTABLE structure contains a count of ARP entries and an array of MIB_IPNETROW structures for each IPv4 address entry.
Note that the returned MIB_IPNETTABLE structure pointed to by the pIpNetTable parameter may contain padding for alignment between the dwNumEntries member and the first MIB_IPNETROW array entry in the table member of the MIB_IPNETTABLE structure. Padding for alignment may also be present between the MIB_IPNETROW array entries. Any access to a MIB_IPNETROW array entry should assume padding may exist.
on Windows Vista and later, the GetIpNetTable2 function can be used to retrieve the neighbor IP addresses for both IPv6 and IPv4.
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | iphlpapi.h |
Library | Iphlpapi.lib |
DLL | Iphlpapi.dll |