PoRegisterSystemState

NTSTATUS __stdcall PoRegisterSystemState(PVOID StateHandle, UINT64 Flags){
  PVOID v2; 
  PVOID v3; 
  int v4; 
  unsigned int v5; 
  int v7; 
  int v8; 
  unsigned int LegacyPowerRequestFlags; 
  UINT64 v10; 
  VOID *PowerRequest; 
  PVOID P; 
  v2 = 0i64;
  LODWORD(v3) = 0;
  v4 = 0;
  P = 0i64;
  v5 = Flags;
  if( (Flags & 0x7FFFFFF8) == 0 )
  {
    if( (_DWORD)Flags && (Flags & 0x80000000) == 0i64 )
    {
      PoSetSystemState((unsigned int)Flags);
    }
    else
    {
      PopDiagTraceRegisterSystemState((unsigned int)Flags, StateHandle);
      PowerRequest = StateHandle;
      v3 = StateHandle;
      if( !StateHandle
        && ((v7 = PoCaptureReasonContext(0i64, 0, 0i64, 1, 0i64, (INT64 *)&P), v2 = P, v7 < 0)
         || (v8 = PopCreateKernelPowerRequest(&PowerRequest, (_DIAGNOSTIC_CONTEXT *)P),
             v3 = PowerRequest,
             v4 = v8,
             v8 < 0))
        || (LegacyPowerRequestFlags = PopGetLegacyPowerRequestFlags(v3, v5, 0i64),
            PopApplyLegacyPowerRequestFlags(v3, v10, LegacyPowerRequestFlags),
            v4 < 0) )
      {
        if( v2 )
          PoDestroyReasonContext(v2);
      }
    }
  }
  return(int)v3;
}

Referenced by:

No references.