diff --git a/reactos/lib/cmlib/CMakeLists.txt b/reactos/lib/cmlib/CMakeLists.txt index 83a1d4bc1c2..7de81f9bde8 100644 --- a/reactos/lib/cmlib/CMakeLists.txt +++ b/reactos/lib/cmlib/CMakeLists.txt @@ -1,6 +1,5 @@ add_definitions( - -D_NTOSKRNL_ -D_NTSYSTEM_ -DNASSERT) diff --git a/reactos/lib/cmlib/cmdata.h b/reactos/lib/cmlib/cmdata.h index dc68b207417..d5313f17a36 100644 --- a/reactos/lib/cmlib/cmdata.h +++ b/reactos/lib/cmlib/cmdata.h @@ -7,13 +7,6 @@ #pragma once -#define REG_INIT_BLOCK_LIST_SIZE 32 -#define REG_INIT_HASH_TABLE_SIZE 3 -#define REG_EXTEND_HASH_TABLE_SIZE 4 -#define REG_VALUE_LIST_CELL_MULTIPLE 4 -#define REG_DATA_SIZE_MASK 0x7FFFFFFF -#define REG_DATA_IN_OFFSET 0x80000000 - // // Key Types // diff --git a/reactos/lib/cmlib/cminit.c b/reactos/lib/cmlib/cminit.c index 29fe1922996..48235d8a055 100644 --- a/reactos/lib/cmlib/cminit.c +++ b/reactos/lib/cmlib/cminit.c @@ -11,19 +11,22 @@ ULONG CmlibTraceLevel = 0; +// FIXME: This function must be replaced by CmpCreateRootNode from ntoskrnl/config/cmsysini.c +// (and CmpCreateRootNode be moved there). BOOLEAN CMAPI CmCreateRootNode( PHHIVE Hive, PCWSTR Name) { + UNICODE_STRING KeyName; PCM_KEY_NODE KeyCell; HCELL_INDEX RootCellIndex; - ULONG NameSize; - /* Allocate the cell */ - NameSize = (ULONG)strlenW(Name) * sizeof(WCHAR); + /* Initialize the node name and allocate it */ + RtlInitUnicodeString(&KeyName, Name); RootCellIndex = HvAllocateCell(Hive, - FIELD_OFFSET(CM_KEY_NODE, Name) + NameSize, + FIELD_OFFSET(CM_KEY_NODE, Name) + + CmpNameSize(Hive, &KeyName), Stable, HCELL_NIL); if (RootCellIndex == HCELL_NIL) return FALSE; @@ -37,9 +40,10 @@ CmCreateRootNode( if (!KeyCell) return FALSE; /* Setup the cell */ - KeyCell->Signature = (USHORT)CM_KEY_NODE_SIGNATURE; + KeyCell->Signature = CM_KEY_NODE_SIGNATURE; KeyCell->Flags = KEY_HIVE_ENTRY | KEY_NO_DELETE; - KeyCell->LastWriteTime.QuadPart = 0; + // KeQuerySystemTime(&KeyCell->LastWriteTime); + KeyCell->LastWriteTime.QuadPart = 0ULL; KeyCell->Parent = HCELL_NIL; KeyCell->SubKeyCounts[Stable] = 0; KeyCell->SubKeyCounts[Volatile] = 0; @@ -54,10 +58,8 @@ CmCreateRootNode( KeyCell->MaxClassLen = 0; KeyCell->MaxValueNameLen = 0; KeyCell->MaxValueDataLen = 0; - - /* Write the name */ - KeyCell->NameLength = (USHORT)NameSize; - RtlCopyMemory(KeyCell->Name, Name, NameSize); + KeyCell->NameLength = CmpCopyName(Hive, KeyCell->Name, &KeyName); + if (KeyCell->NameLength < KeyName.Length) KeyCell->Flags |= KEY_COMP_NAME; /* Return success */ HvReleaseCell(Hive, RootCellIndex);