Author: hbelusca Date: Thu Jan 14 18:03:35 2016 New Revision: 70593
URL: http://svn.reactos.org/svn/reactos?rev=70593&view=rev Log: [CMLIB] - Do not define _NTOSKRNL_ at compilation time, keep only the _NTSYSTEM_ define (and NASSERT). - Remove deprecated unused private flags. - Modify CmCreateRootNode to make it look more similar to the CmpCreateRootNode function of ntoskrnl/config/cmsysini.c, to ease future code adaptation in cmlib & mkhive and then deprecate CmCreateRootNode in favour of CmpCreateRootNode.
Modified: trunk/reactos/lib/cmlib/CMakeLists.txt trunk/reactos/lib/cmlib/cmdata.h trunk/reactos/lib/cmlib/cminit.c
Modified: trunk/reactos/lib/cmlib/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/CMakeLists.txt?re... ============================================================================== --- trunk/reactos/lib/cmlib/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/lib/cmlib/CMakeLists.txt [iso-8859-1] Thu Jan 14 18:03:35 2016 @@ -1,6 +1,5 @@
add_definitions( - -D_NTOSKRNL_ -D_NTSYSTEM_ -DNASSERT)
Modified: trunk/reactos/lib/cmlib/cmdata.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/cmdata.h?rev=7059... ============================================================================== --- trunk/reactos/lib/cmlib/cmdata.h [iso-8859-1] (original) +++ trunk/reactos/lib/cmlib/cmdata.h [iso-8859-1] Thu Jan 14 18:03:35 2016 @@ -6,13 +6,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
Modified: trunk/reactos/lib/cmlib/cminit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/cminit.c?rev=7059... ============================================================================== --- trunk/reactos/lib/cmlib/cminit.c [iso-8859-1] (original) +++ trunk/reactos/lib/cmlib/cminit.c [iso-8859-1] Thu Jan 14 18:03:35 2016 @@ -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 @@ 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 @@ 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);