PopUmpoSendPowerMessage

NTSTATUS __stdcall PopUmpoSendPowerMessage(VOID *SendPowerMessage, size_t Length, UINT8 Synchronous){
  unsigned __int64 v4; 
  VOID **PoolWithTag; 
  NTSTATUS v7; 
  int v8; 
  INT64 v10; 
  INT64 v11; 
  _ALPC_CONTEXT_ATTR *MessageAttribute; 
  PORT_MESSAGE *ReceiveMessage; 
  UINT64 *BufferLength; 
  __int64 v15[2]; 
  _ALPC_MESSAGE_ATTRIBUTES Buffer[20]; 

  v15[0] = 0i64;
  v4 = *(_QWORD *)&Length;
  PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x1000ui64, 1869638997i64);
  if( !PoolWithTag )
    return -1073741670;
  PopAcquireUmpoPushLock(0);
  if( PopAlpcClientPort )
  {
    if( v4 > 0xFD8 )
    {
      v8 = -2147483643;
      goto LABEL_7;
    }
    memset((char *)PoolWithTag + 4, 0i64, 0xFFCu);
    *(_WORD *)PoolWithTag = v4;
    *((_WORD *)PoolWithTag + 1) = v4 + 40;
    memmove(PoolWithTag + 5, SendPowerMessage, v4);
    if( Synchronous )
    {
      memset(Buffer, 0i64, sizeof(Buffer));
      v15[0] = 4096i64;
      v8 = ZwAlpcSendWaitReceivePort(
             (VOID *)PopAlpcClientPort,
             0x20000ui64,
             (PORT_MESSAGE *)PoolWithTag,
             0i64,
             (PORT_MESSAGE *)PoolWithTag,
             (UINT64 *)v15,
             Buffer,
             0i64);
      if( v8 < 0 )
        goto LABEL_7;
      MessageAttribute = (_ALPC_CONTEXT_ATTR *)AlpcGetMessageAttribute(
                                                 Buffer,
                                                 0x20000000ui64,
                                                 v10,
                                                 v11,
                                                 (INT64)ReceiveMessage,
                                                 (INT64)BufferLength);
      v7 = PopUmpoProcessMessage((PORT_MESSAGE *)PoolWithTag, MessageAttribute);
    }
    else
    {
      v7 = ZwAlpcSendWaitReceivePort(
             (VOID *)PopAlpcClientPort,
             0x10000ui64,
             (PORT_MESSAGE *)PoolWithTag,
             0i64,
             0i64,
             0i64,
             0i64,
             0i64);
    }
    v8 = v7;
  }
  else
  {
    v8 = -1073741758;
  }
LABEL_7:
  PopReleaseUmpoPushLock();
  ExFreePoolWithTag(PoolWithTag, 0);
  return v8;
}

Referenced by:

PopEvaluateGlobalUserStatus
PopMonitorProcessLoop
PopNotifySessionUserPowerRequestDeleted
PopNotifyUserPowerRequestAction
PopUmpoSendFlushSleepStudyLoggerNotification
PopUmpoSendLegacyEvent
PopUmpoSendPowerRequestCreate
PopUmpoSendPowerRequestOverrideCleanup
PopUmpoSendPowerRequestOverrideQuery
PopUserPresencePredictionModeCallback