TtmInit

INT64 __stdcall TtmInit(){
  __int64 v1; 
  const wchar_t *v2; 
  __int64 v3; 
  int v4; 
  __int64 v5; 
  const wchar_t *v6; 
  __int64 v7; 
  int v8; 
  UNICODE_STRING SourceString; 
  __int16 result; 
  char result_2; 
  int v12; 
  __int128 v13; 
  int v14; 
  int v15; 
  int v16; 
  void *v17; 
  void *v18; 
  void *v19; 
  if( TtmpEnabled == 1 )
  {
    memset((INT64)&result, 0i64);
    result = 120;
    v12 = 400;
    result_2 = result_2 & 0xF1 | 2;
    v1 = 0x7FFFi64;
    v14 = 2031619;
    v17 = TtmpOpenQueueHandle;
    v15 = 512;
    v18 = TtmpCloseQueueHandle;
    v13 = TtmpQueueMapping;
    v19 = TtmpDeleteQueue;
    v2 = L"TerminalEventQueue";
    v16 = 176;
    SourceString = 0i64;
    do
    {
      if( !*v2 )
        break;
      ++v2;
      --v1;
    }
    while( v1 );
    v3 = (0x7FFF - v1) & ((unsigned __int128)-(__int128)(unsigned __int64)v1 >> 64);
    if( v1 )
    {
      SourceString.Buffer = L"TerminalEventQueue";
      SourceString.Length = 2 * v3;
      SourceString.MaximumLength = 2 * v3 + 2;
    }
    v4 = ObCreateObjectTypeEx(&SourceString, (__int64)&result, 0i64, (__int16 *)0x80, (__int64)&TtmpQueueObjectType);
    if( v4 < 0 )
      KeBugCheckEx(0x19Bu, 2ui64, v4, 0i64, 0i64);
  }
  else
  {
    TtmpQueueObjectType = 0i64;
  }
  ExInitializeResourceLite(&TtmpSessionLock);
  TtmpSession = 0i64;
  if( TtmpEnabled == 1 )
  {
    if( !TtmpProximityEscapeMsec )
      TtmpProximityEscapeMsec = 3000;
    memset((INT64)&result, 0i64);
    result = 120;
    v12 = 400;
    result_2 = result_2 & 0xF1 | 6;
    v5 = 0x7FFFi64;
    v14 = 2031619;
    v17 = TtmpOpenTerminalHandle;
    v18 = TtmpCloseTerminalHandle;
    v13 = TtmpTerminalMapping;
    v19 = TtmpDeleteTerminal;
    v6 = L"Terminal";
    v15 = 512;
    v16 = 288;
    SourceString = 0i64;
    do
    {
      if( !*v6 )
        break;
      ++v6;
      --v5;
    }
    while( v5 );
    v7 = (0x7FFF - v5) & -(__int64)(v5 != 0);
    if( v5 )
    {
      SourceString.Buffer = L"Terminal";
      SourceString.Length = 2 * v7;
      SourceString.MaximumLength = 2 * v7 + 2;
    }
    v8 = ObCreateObjectTypeEx(&SourceString, (__int64)&result, 0i64, 0i64, (__int64)&TtmpTerminalObjectType);
    if( v8 < 0 )
      KeBugCheckEx(0x19Bu, 1ui64, v8, 0i64, 0i64);
  }
  else
  {
    TtmpTerminalObjectType = 0i64;
  }
  TraceLoggingRegisterEx_EtwRegister_EtwSetInformation(&dword_140D2C8E8);
  return TraceLoggingRegisterEx_EtwRegister_EtwSetInformation(&dword_140D2C8B0);
}

Referenced by:

PoInitSystem