PopPowerRequestActionInfo

NTSTATUS __stdcall PopPowerRequestActionInfo(POWER_REQUEST_ACTION *PowerRequestAction){
  VOID *v2; 
  char PreviousMode; 
  int IsAppContainerOrIdentifyLevelContext; 
  _BYTE *v5; 
  _KNOWN_CONTROLLER_TYPE v6; 
  __int32 v7; 
  UINT64 Tag; 
  UINT8 IsAppContainerContext; 
  VOID *PowerRequest; 

  v2 = *(VOID **)PowerRequestAction;
  PreviousMode = KeGetCurrentThread()->PreviousMode;
  PowerRequest = 0i64;
  LODWORD(Tag) = 1917874000;
  IsAppContainerContext = 0;
  IsAppContainerOrIdentifyLevelContext = ObReferenceObjectByHandleWithTag(
                                           v2,
                                           0i64,
                                           PopPowerRequestObjectType,
                                           PreviousMode,
                                           Tag,
                                           &PowerRequest,
                                           0i64);
  if( IsAppContainerOrIdentifyLevelContext >= 0 )
  {
    v5 = PowerRequest;
    if( PowerRequestAction[2] == 3 )
    {
      if( PreviousMode )
      {
        IsAppContainerOrIdentifyLevelContext = SeIsAppContainerOrIdentifyLevelContext(0i64, &IsAppContainerContext);
        if( IsAppContainerOrIdentifyLevelContext >= 0 )
        {
          if( !IsAppContainerContext )
            goto LABEL_6;
          IsAppContainerOrIdentifyLevelContext = -1073741790;
        }
LABEL_10:
        ObfDereferenceObjectWithTag(v5, 0x72506F50ui64);
        return IsAppContainerOrIdentifyLevelContext;
      }
    }
    else if( PowerRequestAction[2] == 4 && PreviousMode != 1 )
    {
      IsAppContainerOrIdentifyLevelContext = -1073741637;
      goto LABEL_10;
    }
LABEL_6:
    v6 = PowerRequestAction[2];
    if( *((_BYTE *)PowerRequestAction + 12) )
    {
      if( v5[136] )
        v7 = PopSetSpecialRequest((_KNOWN_CONTROLLER_TYPE)v5, v6);
      else
        v7 = PoSetPowerRequestInternal(v5, (POWER_REQUEST_TYPE_INTERNAL)v6);
    }
    else if( v5[136] )
    {
      v7 = PopClearSpecialRequest((_PO_POWER_REQUEST *)v5, (_POWER_REQUEST_TYPE)v6);
    }
    else
    {
      v7 = PoClearPowerRequestInternal(v5, (POWER_REQUEST_TYPE_INTERNAL)v6);
    }
    IsAppContainerOrIdentifyLevelContext = v7;
    goto LABEL_10;
  }
  return IsAppContainerOrIdentifyLevelContext;
}

Referenced by:

NtPowerInformation