CmpCreateRootNode

UINT8 __stdcall CmpCreateRootNode(UINT64 *RootCellIndex){
  _DWORD *v1; 
  INT64 v2; 
  _DWORD *v3; 
  UINT16 v4; 
  int v5; 
  _WORD *v6; 
  char *v7; 
  unsigned __int16 v8; 
  struct _UNICODE_STRING DestinationString; 
  _HV_GET_CELL_CONTEXT CellAddressContext; 
  VOID *CellAddress; 
  v2 = CmpMasterHive;
  CellAddress = 0i64;
  DestinationString = 0i64;
  CellAddressContext.Cell = -1;
  v3 = v1;
  *(_DWORD *)&CellAddressContext.BinContext = 0;
  RtlInitUnicodeString(&DestinationString, L"REGISTRY", (WCHAR)v1);
  v4 = CmpNameSize(&DestinationString);
  v5 = HvAllocateCell((_HHIVE *)v2, (unsigned int)v4 + 76, Stable, &CellAddress, &CellAddressContext);
  *v3 = v5;
  if( v5 == -1 )
    return 0;
  v6 = CellAddress;
  *(_DWORD *)(*(_QWORD *)(v2 + 64) + 36i64) = v5;
  *(_DWORD *)v6 = 813934;
  v7 = (char *)CellAddress;
  *(_QWORD *)((char *)CellAddress + 4) = *(_QWORD *)&KUSER_SHARED_DATA.SystemTime.LowPart;
  *((_DWORD *)v7 + 4) = -1;
  *(_QWORD *)(v7 + 20) = 0i64;
  *((_DWORD *)v7 + 7) = -1;
  *((_DWORD *)v7 + 8) = -1;
  *((_DWORD *)v7 + 9) = 0;
  *((_DWORD *)v7 + 10) = -1;
  *((_DWORD *)v7 + 11) = -1;
  *((_DWORD *)v7 + 12) = -1;
  *((_WORD *)v7 + 37) = 0;
  *(_QWORD *)(v7 + 60) = 0i64;
  *((_WORD *)v7 + 26) = 0;
  *((_DWORD *)v7 + 13) &= 0xFF00FFFF;
  v7[55] = 0;
  *((_DWORD *)v7 + 14) = 0;
  v8 = CmpCopyName((PWCHAR)v7 + 38, &DestinationString);
  *((_WORD *)v7 + 36) = v8;
  if( v8 < DestinationString.Length )
    v6[1] |= 0x20u;
  (*(void(__fastcall **)(INT64, _HV_GET_CELL_CONTEXT *))(v2 + 16))(v2, &CellAddressContext);
  return 1;
}

Referenced by:

CmpCreateRegistryRoot