CmInitSystem1

char __fastcall CmInitSystem1(_LOADER_PARAMETER_BLOCK *LoaderBlock){
  _DWORD *v2; 
  __int64 v3; 
  int ObjectTypes; 
  int v5; 
  int v6; 
  int Hive; 
  NTSTATUS v8; 
  PKINTERRUPT_ROUTINE **v9; 
  UINT32 v10; 
  PKINTERRUPT_ROUTINE *v11; 
  INT64 v12; 
  int inited; 
  UINT8 v14; 
  CHAR *v15; 
  NTSTATUS v16; 
  void *v17; 
  NTSTATUS v18; 
  void *v19; 
  NTSTATUS v20; 
  void *v21; 
  NTSTATUS v22; 
  void *v23; 
  NTSTATUS v24; 
  NTSTATUS ControlSet; 
  int v26; 
  INT64 v27; 
  void *v28; 
  int v29; 
  NTSTATUS v30; 
  INT64 v31; 
  _WCHAR v32; 
  int v33; 
  int ExtendedControlSets; 
  __int64 v35; 
  NTSTATUS v36; 
  __int64 v37; 
  __int64 v38; 
  INT64 v39; 
  int v40; 
  __int64 v41; 
  __int64 v42; 
  __int64 v43; 
  INT64 v44; 
  _LOADER_PARAMETER_EXTENSION *Extension; 
  __int64 NetworkLoaderBlock; 
  int v47; 
  int v48; 
  _UNICODE_STRING *Class; 
  _UNICODE_STRING *Classa; 
  UINT64 CreateOptions; 
  UINT64 CreateOptionsa; 
  UINT64 CreateOptionsb; 
  UINT64 Flags; 
  UINT64 Flagsa; 
  VOID *KeyHandle; 
  CMHIVE *CmHive; 
  _OBJECT_ATTRIBUTES ObjectAttributes; 
  _UNICODE_STRING DestinationString; 
  _KAPC_STATE ApcState; 
  int ParseContext[76]; 
  char BugCheckParameter4[432]; 

  KeyHandle = 0i64;
  *(&ObjectAttributes.Length + 1) = 0;
  *(&ObjectAttributes.Attributes + 1) = 0;
  CmHive = 0i64;
  memset(ParseContext, 0i64, 0x128u);
  DestinationString = 0i64;
  memset(BugCheckParameter4, 0i64, sizeof(BugCheckParameter4));
  memset(&ApcState, 0, sizeof(ApcState));
  CmpInitializeParseContext((INT64)ParseContext);
  *(&CmpDummyThreadEvent + 344) = &IoFileObjectType;
  if( InitIsWinPEMode )
  {
    CmpMiniNTBoot = InitIsWinPEMode;
    BYTE4(NlsMbCodePageTag) = 1;
    CmpForceSynchronousMachineHiveLoad = 1;
  }
  if( *(&stru_140CF2E80 + 1867) )
    BYTE4(NlsMbCodePageTag) = 1;
  CmpInitializeRegistryNames();
  CmpInitGlobalQuotaAllowed();
  *(&CmpDummyThreadEvent + 340) = 0i64;
  qword_140D2D918 = (__int64)&CmpHiveListHead;
  CmpHiveListHead = (__int64)&CmpHiveListHead;
  *(&CmpDummyThreadEvent + 341) = 0i64;
  *(&CmpDummyThreadEvent + 339) = 0i64;
  ExInitializePushLock((PULONG_PTR)&CmpDummyThreadEvent + 132);
  *(&CmpDummyThreadEvent + 133) = 0i64;
  *(&CmpDummyThreadEvent + 109) = (char *)&CmpDummyThreadEvent + 864;
  *(&CmpDummyThreadEvent + 108) = (char *)&CmpDummyThreadEvent + 864;
  *(&CmpDummyThreadEvent + 112) = 0i64;
  *(&CmpDummyThreadEvent + 110) = 0i64;
  ExInitializeResourceLite((INT64)&CmpRegistryLock);
  *(&CmpDummyThreadEvent + 200) = 1;
  *(&CmpDummyThreadEvent + 105) = (char *)&CmpDummyThreadEvent + 832;
  *(&CmpDummyThreadEvent + 104) = (char *)&CmpDummyThreadEvent + 832;
  qword_140D2C6B8 = (__int64)&CmpAsyncKernelPostList;
  CmpAsyncKernelPostList = (INT64)&CmpAsyncKernelPostList;
  *(&CmpDummyThreadEvent + 126) = CmpWorkerEngineWorker;
  *(&CmpDummyThreadEvent + 101) = 0i64;
  *(&CmpDummyThreadEvent + 204) = 0;
  *(&CmpDummyThreadEvent + 412) = 1;
  *(&CmpDummyThreadEvent + 826) = 6;
  *(&CmpDummyThreadEvent + 207) = 0;
  *(&CmpDummyThreadEvent + 127) = 0i64;
  *(&CmpDummyThreadEvent + 124) = 0i64;
  KeInitializeGuardedMutex((PKGUARDED_MUTEX)((char *)&CmpDummyThreadEvent + 928));
  *(&CmpDummyThreadEvent + 128) = 0i64;
  *(&CmpDummyThreadEvent + 131) = (char *)&CmpDummyThreadEvent + 1040;
  *(&CmpDummyThreadEvent + 130) = (char *)&CmpDummyThreadEvent + 1040;
  CmpInitializeNameCache();
  CmpInitCmPrivateAlloc();
  CmpInitSIDToHiveMapping();
  SecurityDescriptor = (INT64)CmpAdminSystemSecurityDescriptor();
  CmpInitializeTrustedInstallerSid();
  CmpInitializeDelayedCloseTable();
  CmpInitCallbacks();
  CmpInitializeMachineHiveLoadedCallbacks();
  CmpInitializeFreezeThaw();
  HvInitializeHashLibrary();
  CmpValidateGlobalFlushControlFlags();
  CmpInitializeGlobalKeyLockTracker();
  CmpInitializeTransactions();
  CmpVolumeManagerInitialize();
  v2 = (_DWORD *)((char *)&stru_140C00F40 + 1548);
  v3 = 8i64;
  do
  {
    RtlInitUnicodeString(&DestinationString, *(PCWSTR *)(v2 - 3));
    *v2 = CmpHashUnicodeComponent(&DestinationString);
    v2 += 6;
    --v3;
  }
  while( v3 );
  ObjectTypes = CmpCreateObjectTypes();
  if( ObjectTypes < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)1, (PVOID)ObjectTypes, 0i64);
  v5 = CmpInitializeLightWeightTransactionType();
  if( v5 < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x18, (PVOID)v5, 0i64);
  v6 = CmpInitializeRegistryProcess();
  if( v6 < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x19, (PVOID)v6, 0i64);
  CmpAttachToRegistryProcess(&ApcState);
  CmpLockRegistryExclusive();
  CmpInitializePreloadedHives(LoaderBlock, 0i64);
  LODWORD(Flags) = 0;
  Hive = CmpCreateHive(
           (INT64)&CmpMasterHive,
           0i64,
           1ui64,
           0i64,
           0i64,
           0i64,
           0i64,
           Flags,
           0i64,
           0i64,
           0i64,
           (INT64)BugCheckParameter4);
  if( Hive < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)2, (PVOID)Hive, BugCheckParameter4);
  v8 = CmpInitializeKcbCache(*(_CMHIVE **)&CmpMasterHive, 0x80ui64);
  if( v8 < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)3, (PVOID)v8, 0i64);
  if( !(unsigned __int8)CmpCreateRegistryRoot() )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)4, 0i64, 0i64);
  LODWORD(v12) = HalSystemVectorDispatchEntry(v10, v9, v11);
  inited = CmpInitSiloSupport(v12);
  if( inited < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x1A, (PVOID)inited, 0i64);
  v15 = CmpHiveRootSecurityDescriptor(v14);
  LODWORD(CreateOptions) = 0;
  ObjectAttributes.ObjectName = &CmRegistryMachineName;
  ObjectAttributes.Length = 48;
  ObjectAttributes.RootDirectory = 0i64;
  ObjectAttributes.Attributes = 576;
  ObjectAttributes.SecurityDescriptor = v15;
  ObjectAttributes.SecurityQualityOfService = 0i64;
  v16 = ZwCreateKey(
          &KeyHandle,
          0x2001Fui64,
          &ObjectAttributes,
          0i64,
          (_UNICODE_STRING *)&nullclass,
          CreateOptions,
          0i64);
  v17 = (void *)v16;
  if( v16 < 0 )
  {
    ExFreePoolWithTag(v15, 0);
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)5, v17, 0i64);
  }
  ZwClose((_HANDLE)KeyHandle);
  ObjectAttributes.ObjectName = &CmRegistryUserName;
  LODWORD(CreateOptionsa) = 0;
  ObjectAttributes.Length = 48;
  ObjectAttributes.RootDirectory = 0i64;
  ObjectAttributes.Attributes = 576;
  ObjectAttributes.SecurityDescriptor = v15;
  ObjectAttributes.SecurityQualityOfService = 0i64;
  v18 = ZwCreateKey(
          &KeyHandle,
          0x2001Fui64,
          &ObjectAttributes,
          0i64,
          (_UNICODE_STRING *)&nullclass,
          CreateOptionsa,
          0i64);
  v19 = (void *)v18;
  if( v18 < 0 )
  {
    ExFreePoolWithTag(v15, 0);
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)6, v19, 0i64);
  }
  ZwClose((_HANDLE)KeyHandle);
  ObjectAttributes.ObjectName = &CmRegistryAppName;
  ObjectAttributes.Length = 48;
  ObjectAttributes.RootDirectory = 0i64;
  LODWORD(Class) = 131103;
  ObjectAttributes.Attributes = 576;
  ObjectAttributes.SecurityDescriptor = v15;
  ObjectAttributes.SecurityQualityOfService = 0i64;
  ParseContext[0] = 65;
  v20 = ObOpenObjectByName(
          &ObjectAttributes,
          (_OBJECT_TYPE *)CmKeyObjectType,
          0,
          0i64,
          (UINT64)Class,
          ParseContext,
          &KeyHandle);
  v21 = (void *)v20;
  if( v20 < 0 )
  {
    ExFreePoolWithTag(v15, 0);
    CmpCleanupParseContext((INT64)ParseContext, 0);
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)7, v21, 0i64);
  }
  CmpCleanupParseContext((INT64)ParseContext, 0);
  ZwClose((_HANDLE)KeyHandle);
  ObjectAttributes.ObjectName = &CmRegistryContainersName;
  LODWORD(CreateOptionsb) = 0;
  ObjectAttributes.Length = 48;
  ObjectAttributes.RootDirectory = 0i64;
  ObjectAttributes.Attributes = 576;
  ObjectAttributes.SecurityDescriptor = v15;
  ObjectAttributes.SecurityQualityOfService = 0i64;
  v22 = ZwCreateKey(
          &KeyHandle,
          0x2001Fui64,
          &ObjectAttributes,
          0i64,
          (_UNICODE_STRING *)&nullclass,
          CreateOptionsb,
          0i64);
  v23 = (void *)v22;
  if( v22 < 0 )
  {
    ExFreePoolWithTag(v15, 0);
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)8, v23, 0i64);
  }
  ZwClose((_HANDLE)KeyHandle);
  CmpNoMasterCreates = 1;
  CmpInitializeLoadOptions(LoaderBlock);
  v24 = CmpInitializePreloadedHives(LoaderBlock, 1ui64);
  if( v24 < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x14, (PVOID)v24, 0i64);
  ControlSet = CmpCreateControlSet((_LOADER_PARAMETER_BLOCK *)L"SYSTEM");
  if( ControlSet < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0xD, (PVOID)ControlSet, 0i64);
  if( CmpLKGEnabled )
    KUSER_SHARED_DATA.SharedDataFlags |= 0x10u;
  if( *(&stru_140CF2E80 + 1656) )
    CmpUpdateStateSeparationHiveOptions();
  memset(BugCheckParameter4, 0i64, sizeof(BugCheckParameter4));
  LODWORD(Flagsa) = 0;
  v26 = CmpCreateHive(
          (INT64)&CmHive,
          0i64,
          1ui64,
          0i64,
          0i64,
          0i64,
          0i64,
          Flagsa,
          0i64,
          0i64,
          0i64,
          (INT64)BugCheckParameter4);
  v28 = (void *)v26;
  if( v26 < 0 )
  {
    ExFreePoolWithTag(v15, 0);
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x10, v28, BugCheckParameter4);
  }
  LOBYTE(v27) = 1;
  LODWORD(Classa) = KcbCacheSize;
  v29 = CmpLinkHiveToMaster(
          &CmRegistryMachineHardwareName,
          0i64,
          CmHive,
          v27,
          (UINT64)Classa,
          0,
          0i64,
          v15,
          0i64,
          0i64,
          1u);
  if( v29 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x11, (PVOID)v29, 0i64);
  CmpAddToHiveFileList(CmHive);
  ExFreePoolWithTag(v15, 0);
  qword_140C00F18 = (__int64)CmHive;
  v30 = CmpInitializeHardwareConfiguration(LoaderBlock);
  if( v30 < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x12, (PVOID)v30, 0i64);
  v33 = CmpInitializeDriverStores((INT64)LoaderBlock, v31, v32);
  if( v33 < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x13, (PVOID)v33, 0i64);
  ExtendedControlSets = CmpCreateExtendedControlSets((INT64)LoaderBlock);
  if( ExtendedControlSets < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x1B, (PVOID)ExtendedControlSets, 0i64);
  CmpCreateHardwareProfiles((INT64)LoaderBlock);
  CmSetInitMachineConfig(LoaderBlock);
  CmpUnlockRegistry();
  CmpMarkCurrentProfileDirty(v35);
  v36 = CmpInitializeMachineDependentConfiguration(LoaderBlock);
  if( v36 < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x15, (PVOID)v36, 0i64);
  v40 = CmpSetSystemValues((__int64)LoaderBlock, v37, v38, v39);
  if( v40 < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x16, (PVOID)v40, 0i64);
  CmpMigrateOOBELanguageToInstallationLanguage(v42, v41, v43, v44);
  ExFreePoolWithTag(CmpLoadOptions.Buffer, 0);
  Extension = LoaderBlock->Extension;
  if( Extension->Size >= 0x68 )
  {
    NetworkLoaderBlock = (__int64)Extension->NetworkLoaderBlock;
    if( NetworkLoaderBlock )
    {
      v47 = CmpSetNetworkValue(NetworkLoaderBlock);
      if( v47 < 0 )
        KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x17, (PVOID)v47, 0i64);
    }
  }
  v48 = CmFcInitSystem2();
  if( v48 < 0 )
    KeBugCheckEx(0x67u, (PVOID)1, (PVOID)0x1A, (PVOID)v48, 0i64);
  CmpDetachFromRegistryProcess(&ApcState);
  return 1;
}

Referenced by:

No references.