SetGlobalInfo Sample

[This is preliminary documentation and subject to change.]

DWORD
APIENTRY
SetGlobalInfo(
    IN PVOID pvConfig
    )
/*++
  Routine Description
      Called by the IP Router Manager usually in response to an admin
      utility changing the config.  We verify the parameters and the
      info and set it

  Arguments


  Return Value
      ERROR_INVALID_PARAMETER
      ERROR_INVALID_DATA
      NO_ERROR

--*/
{
    PSAMPLE_PROTOCOL_GLOBAL_INFO    pGlobalInfo;

    EnterProtocolApi();

    TraceEnter("SetGlobalInfo");

    if(pvConfig == NULL)
    {
        Trace0(ERR,
               "SetGlobalInfo: Router Manager called us with NULL info");

        TraceLeave("SetGlobalInfo");

        ExitProtocolApi();

        return ERROR_INVALID_PARAMETER;
    }
    

    pGlobalInfo = (PSAMPLE_PROTOCOL_GLOBAL_INFO)pvConfig;
    
    if(!ValidateGlobalInfo(pGlobalInfo))
    {
        //
        // Bad global info
        //

        TraceLeave("SetGlobalInfo");

        ExitProtocolApi();

        return ERROR_INVALID_DATA;
    }

    //
    // Good info
    //

    EnterCriticalSection(&g_csGlobalInfoLock);

    g_dwLogLevel = pGlobalInfo->dwLogLevel;

    LeaveCriticalSection(&g_csGlobalInfoLock);
    
    TraceLeave("SetGlobalInfo");

    ExitProtocolApi();

    return ERROR_INVALID_DATA;

}