GetIPForwardTable return’s undocumented error ERROR_MORE_DATA where it should actually return ERROR_INSUFFICIENT_BUFFER in a Windows XP environment.
Is this an expected behavior? How we should handle the situation when ERROR_MORE_DATA is returned.
a) At start, the API does a quick check if the buffer size is insufficient. If it is, then ERROR_INSUFFICIENT_BUFFER is returned AND no data is put in the user supplied buffer. The output buffer size is updated to reflect the size of buffer caller should provide.
b) If the first check passes, API tries to pull actual data from stack and does a second check for size. If forwarding table size has changed and buffer size is no longer sufficient, ERROR_MORE_DATA is returned and the buffer is filled with whatever number of entries it can accommodate.
The error ERROR_MORE_DATA is an expected error code, but MSDN documentation did not explains about this . When you hit this error, loop continuously calling
GetIPForwardTable until it succeeds.
Windows SDK – Base Kernel/Networking.