[This is preliminary documentation and subject to change.]
DWORD
APIENTRY
GetGlobalInfo(
IN OUT PVOID pvConfig,
IN OUT PDWORD pdwSize
)
/*++
Routine Description
The function is called by the IP Router Manager, usually in
because of a query by the admin utility. We see if we have space
enough to return our global config. If we do we return it,
otherwise we return the size needed.
Arguments
pvConfig Pointer to allocated buffer to store our config
pdwSize Size of config.
Return Value
ERROR_INSUFFICIENT_BUFFER If the size of the buffer is too small
ERROR_INVALID_PARAMETER
ERROR_INVALID_DATA
NO_ERROR
--*/
{
PSAMPLE_PROTOCOL_GLOBAL_INFO pGlobalInfo;
EnterProtocolApi();
TraceEnter("GetGlobalInfo");
if(pdwSize == NULL)
{
Trace0(ERR,
"GetGlobalInfo: Router Manager called us with NULL size");
TraceLeave("GetGlobalInfo");
ExitProtocolApi();
return ERROR_INVALID_PARAMETER;
}
if((*pdwSize < sizeof(SAMPLE_PROTOCOL_GLOBAL_INFO))||
(pvConfig == NULL))
{
//
// Either the size was too small or there was no
// storage
//
*pdwSize = sizeof(SAMPLE_PROTOCOL_GLOBAL_INFO);
Trace3(GLOBAL,
"GetGlobalInfo: Router Manager called us with size %d and info %x. Info size should be %d",
*pdwSize,
pvConfig,
sizeof(SAMPLE_PROTOCOL_GLOBAL_INFO));
TraceLeave("GetGlobalInfo");
ExitProtocolApi();
return ERROR_INSUFFICIENT_BUFFER;
}
*pdwSize = sizeof(SAMPLE_PROTOCOL_GLOBAL_INFO);
//
// Ok, so we have a good buffer to write our info into
//
pGlobalInfo = (PSAMPLE_PROTOCOL_GLOBAL_INFO)pvConfig;
//
// Currently that is all the info we have
//
EnterCriticalSection(&g_csGlobalInfoLock);
pGlobalInfo->dwLogLevel = g_dwLogLevel;
LeaveCriticalSection(&g_csGlobalInfoLock);
TraceLeave("GetGlobalInfo");
ExitProtocolApi();
return NO_ERROR;
}