TtmpAcquireSessionById

__int64 __fastcall TtmpAcquireSessionById(_QWORD *a1, int a2){
  unsigned int v2; 
  bool v4; 
  _ETHREAD *CurrentThread; 
  v2 = 0;
  v4 = TtmpEnabled == 1;
  *a1 = 0i64;
  if( v4 )
  {
    CurrentThread = (_ETHREAD *)KeGetCurrentThread();
    --*((_WORD *)CurrentThread + 242);
    ExAcquireResourceExclusiveLite(&TtmpSessionLock, 1u);
    if( TtmpSession && *(_DWORD *)TtmpSession == a2 )
    {
      *a1 = TtmpSession;
    }
    else
    {
      v2 = -1073740715;
      TtmiLogError((PSTR)"TtmpAcquireSessionById", 1701i64, 0xFFFFFFFFi64, 3221226581i64);
      ExReleaseResourceLite(&TtmpSessionLock);
      KeLeaveCriticalRegion();
    }
  }
  else
  {
    v2 = -1073741637;
    TtmiLogError((PSTR)"TtmpAcquireSessionById", 1690i64, 0xFFFFFFFFi64, 3221225659i64);
  }
  return v2;
}

Referenced by:

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