ExpInitSystemPhase1

UINT8 __stdcall ExpInitSystemPhase1(){
  unsigned int v0; 
  char v1; 
  unsigned int v2; 
  char v3; 
  char v4; 
  char v5; 
  char v6; 
  char v7; 
  char v8; 
  char v9; 
  char v10; 
  UINT8 v11; 
  char v12; 
  VOID **PoolWithTag; 
  char v14; 
  char v15; 
  UINT8 v16; 
  int v17; 
  UINT64 v18; 
  UINT64 v19; 
  char v21[8]; 
  _NT_PRODUCT_TYPE v22; 
  int v23[2]; 
  __int64 v24; 
  __int64 v25; 
  VOID(__stdcall *v26)(INT64, _EX_RUNDOWN_REF **); 
  __int64 v27; 
  int RegistrationInfo[2]; 
  __int64 v29; 
  __int64 v30; 
  VOID(__stdcall *v31)(_EX_HOST_CALLBACK_REASON, VOID *); 
  __int64 v32; 
  UINT64 ReturnedProductType; 

  ExpSpinCycleCount = 0;
  KeQueryMaximumProcessorCountEx(0xFFFFu);
  if( v0 > 1 )
    ExpSpinCycleCount = 10240;
  ExpHostListLock._bf_0 = 0i64;
  qword_140D2DBD8 = (__int64)&ExpHostList;
  ExpHostList = (__int64)&ExpHostList;
  *(&ExBootDevicesRemovedEvent + 40) = 0i64;
  *(&ExBootDevicesRemovedEvent + 20) = 0i64;
  ExpPlatformBinaryLock._bf_0 = 0i64;
  v1 = 1;
  v2 = 0;
  if( ExpWorkerInitialization() < 0 )
    v1 = 0;
  if( (_DWORD)KeNumberProcessors_0 )
  {
    do
      ExInitializeProcessor(*(&KiProcessorBlock + v2++), 0);
    while( v2 < (unsigned int)KeNumberProcessors_0 );
  }
  v3 = ExpEventInitialization() != 0 ? v1 : 0;
  v4 = ExpMutantInitialization() != 0 ? v3 : 0;
  v5 = ExpAeThresholdInitialization() != 0 ? v4 : 0;
  v6 = ExpInitializeCallbacks() != 0 ? v5 : 0;
  v7 = ExpSemaphoreInitialization() != 0 ? v6 : 0;
  v8 = ExpTimerInitialization() != 0 ? v7 : 0;
  *(&WheapDeferredInternalLogsEventLock + 65) = ExAllocateTimer((INT64)ExpHpGCTimerCallback, 0i64, 8ui64);
  if( *(&WheapDeferredInternalLogsEventLock + 65)
    && (*(&WheapDeferredInternalLogsEventLock + 57) = ExAllocateTimer((INT64)ExpHpGCTimerCallback, 1i64, 8ui64)) != 0i64 )
  {
    *(&WheapDeferredInternalLogsEventLock + 133) = 0;
    v9 = 1;
    *(&WheapDeferredInternalLogsEventLock + 132) = 0;
    *(&WheapDeferredInternalLogsEventLock + 128) = 1;
  }
  else
  {
    v9 = 0;
  }
  v10 = v9 != 0 ? v8 : 0;
  v11 = ExpProfileInitialization();
  stru_140CEC740._bf_0 = 0i64;
  ExpUuidLastTimeAllocated = *(_QWORD *)&KUSER_SHARED_DATA.SystemTime.LowPart;
  v12 = v11 != 0 ? v10 : 0;
  if( ExpKeyedEventInitialization() < 0 )
    v12 = 0;
  PoolWithTag = ExAllocatePoolWithTag(0x200ui64, 0x30ui64, 543583831i64);
  ExpWnfDispatcher = (__int64)PoolWithTag;
  if( PoolWithTag )
  {
    *(_OWORD *)PoolWithTag = 0i64;
    *((_OWORD *)PoolWithTag + 1) = 0i64;
    *((_OWORD *)PoolWithTag + 2) = 0i64;
    *(_DWORD *)PoolWithTag = 3148040;
    PoolWithTag[3] = ExpWnfWorkItemRoutine;
    PoolWithTag[4] = 0i64;
    PoolWithTag[1] = 0i64;
    v14 = 1;
  }
  else
  {
    v14 = 0;
  }
  v15 = ExpWin32Initialization() != 0 ? (v14 != 0 ? v12 : 0) : 0;
  if( ExpWorkerFactoryInitialization() < 0 )
    v15 = 0;
  v16 = ExpSaInitialize() != 0 ? v15 : 0;
  v17 = ExpMicrocodeInitialization(1i64);
  if( (int)(v17 + 0x80000000) >= 0 && v17 != -1073741637 )
    v16 = 0;
  LODWORD(ReturnedProductType) = 0;
  v22 = 0;
  if( RtlGetProductInfo(6ui64, 0i64, 0i64, 0i64, &ReturnedProductType)
    && (_DWORD)ReturnedProductType != -1412584499
    && ExpGetProductInfoSuiteTypeMap(ReturnedProductType, (__int64)v21)
    && KUSER_SHARED_DATA.NtProductType != v22
    && (KUSER_SHARED_DATA.NtProductType != NtProductLanManNt || v22 != NtProductServer) )
  {
    KUSER_SHARED_DATA.NtProductType = v22;
  }
  RegistrationInfo[1] = 5;
  v31 = ExpPcwHostCallback;
  v29 = 1i64;
  RegistrationInfo[0] = 65537;
  v30 = 0i64;
  v32 = 0i64;
  if( ExRegisterHost((_EX_HOST **)&ExpPcwExtensionHost, v18, RegistrationInfo) < 0 )
    ExpPcwExtensionHost = 0i64;
  if( (_BYTE)HvlHypervisorConnected )
  {
    v23[1] = 1;
    v24 = 512i64;
    v26 = ExpCrossVmIntHostCallback;
    v25 = 0i64;
    if( (HvlpFlags & 2) != 0 )
    {
      v23[0] = 196623;
      v27 = (__int64)&WheapDeferredInternalLogsEventLock + 432;
      if( ExRegisterHost((_EX_HOST **)&WheapDeferredInternalLogsEventLock + 54, v19, v23) < 0 )
        *(&WheapDeferredInternalLogsEventLock + 54) = 0i64;
    }
    else
    {
      v23[0] = 196624;
      v27 = (__int64)&WheapDeferredInternalLogsEventLock + 424;
      if( ExRegisterHost((_EX_HOST **)&WheapDeferredInternalLogsEventLock + 53, v19, v23) < 0 )
        *(&WheapDeferredInternalLogsEventLock + 53) = 0i64;
    }
  }
  ExpInitializeSvm();
  return v16;
}

Referenced by:

ExInitSystem