GetGatewayBuffer
Retrieves the default gateway buffer for the current system.
Function Summary
The GetGatewayBuffer function is part of the IP Helper API. It allows applications to retrieve information about the default gateway configured on the system.
Syntax
DWORD GetGatewayBuffer(
_Out_ PMIB_IPFORWARDTABLE pIpForwardTable
);
Parameters
| Parameter | Description |
|---|---|
pIpForwardTable |
A pointer to a MIB_IPFORWARDTABLE structure that receives the gateway buffer. This structure contains an array of IP routing entries. |
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_INSUFFICIENT_BUFFER: The buffer provided is too small to hold the routing information.ERROR_NOT_SUPPORTED: The operation is not supported on the current system.- Other Win32 error codes.
Remarks
The GetGatewayBuffer function retrieves IP routing information, including the default gateway. The returned data is structured in a MIB_IPFORWARDTABLE, which contains an array of MIB_IPFORWARDROW structures. Each entry represents a route.
To use this function, you typically need to allocate a buffer of sufficient size for the MIB_IPFORWARDTABLE structure.
GetIpForwardTable with a NULL buffer pointer to get the required buffer size, then allocate the buffer and call the function again with the allocated buffer.
Requirements
| Component | Value |
|---|---|
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Header | iprtrmib.h |
| Library | Iphlpapi.lib |
| DLL | Iphlpapi.dll |