TtmpAcquireSessionById

VOID *__fastcall TtmpAcquireSessionById(_TTMI_SESSION **Session, UINT64 SessionId){
  INT64 v2; 
  unsigned int v3; 
  int v4; 
  bool v5; 
  _ETHREAD *CurrentThread; 

  v3 = 0;
  v4 = SessionId;
  v5 = TtmpEnabled == 1;
  *Session = 0i64;
  if( v5 )
  {
    CurrentThread = (_ETHREAD *)KeGetCurrentThread();
    --CurrentThread->Tcb.KernelApcDisable;
    ExAcquireResourceExclusiveLite((UINT64)&TtmpSessionLock, 1, v2);
    if( TtmpSession && *(_DWORD *)TtmpSession == v4 )
    {
      *Session = (_TTMI_SESSION *)TtmpSession;
    }
    else
    {
      v3 = -1073740715;
      TtmiLogError((INT8 *)"TtmpAcquireSessionById", 0x6A5ui64, 0xFFFFFFFFi64, 3221226581i64);
      ExReleaseResourceLite(&TtmpSessionLock);
      KeLeaveCriticalRegion();
    }
  }
  else
  {
    v3 = -1073741637;
    TtmiLogError((INT8 *)"TtmpAcquireSessionById", 0x69Aui64, 0xFFFFFFFFi64, 3221225659i64);
  }
  return(VOID *)v3;
}

Referenced by:

TtmGetSessionDisplayRequiredCount
TtmNotifyConsoleUserPresent
TtmNotifyLowPowerStateExited
TtmNotifySessionDisplayBurst
TtmNotifySessionDisplayRequiredChange
TtmNotifySessionPowerRequestDeleted
TtmNotifySessionPowerStateChange
TtmNotifySessionTerminalInput
TtmSessionMonitorControl
TtmiAcquireCurrentSession
TtmpInsertPowerRequestToSession
TtmpUpdatePowerRequestAttribute