- 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.

svn path=/trunk/; revision=70593
This commit is contained in:
Hermès Bélusca-Maïto 2016-01-14 18:03:35 +00:00
parent 5cef0d2fc2
commit 62e9fb7872
3 changed files with 12 additions and 18 deletions

View file

@ -1,6 +1,5 @@
add_definitions(
-D_NTOSKRNL_
-D_NTSYSTEM_
-DNASSERT)

View file

@ -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
//

View file

@ -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);