From d5533a3ed77bfd9c2ed8e8c0b58a09584a0096e4 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Tue, 27 May 2003 13:58:26 +0000 Subject: [PATCH] Updated registry key flags. 0x20 means packed key name. svn path=/trunk/; revision=4766 --- reactos/ntoskrnl/cm/cm.h | 22 ++++++++++++++-------- reactos/ntoskrnl/cm/ntfunc.c | 2 +- reactos/ntoskrnl/cm/regfile.c | 18 ++++++------------ reactos/ntoskrnl/cm/regobj.c | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/reactos/ntoskrnl/cm/cm.h b/reactos/ntoskrnl/cm/cm.h index 80443665766..7f6ee65f0ce 100644 --- a/reactos/ntoskrnl/cm/cm.h +++ b/reactos/ntoskrnl/cm/cm.h @@ -140,8 +140,8 @@ typedef struct _KEY_CELL /* Key cell identifier "kn" (0x6b6e) */ USHORT Id; - /* ? */ - USHORT Type; + /* Flags */ + USHORT Flags; /* Time of last flush */ FILETIME LastWriteTime; @@ -189,14 +189,19 @@ typedef struct _KEY_CELL UCHAR Name[0]; } __attribute__((packed)) KEY_CELL, *PKEY_CELL; -/* KEY_CELL.Type constants */ -#define REG_LINK_KEY_CELL_TYPE 0x10 -#define REG_KEY_CELL_TYPE 0x20 -#define REG_ROOT_KEY_CELL_TYPE 0x2c +/* KEY_CELL.Flags constants */ +#define REG_KEY_ROOT_CELL 0x0C +#define REG_KEY_LINK_CELL 0x10 +#define REG_KEY_NAME_PACKED 0x20 -// hash record : -// HashValue=four letters of value's name +/* + * Hash record + * + * HashValue : + * packed name: four letters of value's name + * otherwise: Zero! + */ typedef struct _HASH_RECORD { BLOCK_OFFSET KeyOffset; @@ -211,6 +216,7 @@ typedef struct _HASH_TABLE_CELL HASH_RECORD Table[0]; } __attribute__((packed)) HASH_TABLE_CELL, *PHASH_TABLE_CELL; + typedef struct _VALUE_LIST_CELL { LONG CellSize; diff --git a/reactos/ntoskrnl/cm/ntfunc.c b/reactos/ntoskrnl/cm/ntfunc.c index 6d4f7b5fb37..e347e04cf2c 100644 --- a/reactos/ntoskrnl/cm/ntfunc.c +++ b/reactos/ntoskrnl/cm/ntfunc.c @@ -1321,7 +1321,7 @@ NtSetValueKey(IN HANDLE KeyHandle, if ((_wcsicmp(ValueName->Buffer, L"SymbolicLinkValue") == 0) && (Type == REG_LINK)) { - KeyCell->Type = REG_LINK_KEY_CELL_TYPE; + KeyCell->Flags |= REG_KEY_LINK_CELL; CmiMarkBlockDirty(RegistryHive, KeyObject->BlockOffset); } diff --git a/reactos/ntoskrnl/cm/regfile.c b/reactos/ntoskrnl/cm/regfile.c index 4e56ccac1ae..7c2b36c0f40 100644 --- a/reactos/ntoskrnl/cm/regfile.c +++ b/reactos/ntoskrnl/cm/regfile.c @@ -80,7 +80,7 @@ CmiCreateDefaultRootKeyCell(PKEY_CELL RootKeyCell) RtlZeroMemory(RootKeyCell, sizeof(KEY_CELL)); RootKeyCell->CellSize = -sizeof(KEY_CELL); RootKeyCell->Id = REG_KEY_CELL_ID; - RootKeyCell->Type = REG_ROOT_KEY_CELL_TYPE; + RootKeyCell->Flags = REG_KEY_ROOT_CELL | REG_KEY_NAME_PACKED; NtQuerySystemTime((PTIME) &RootKeyCell->LastWriteTime); RootKeyCell->ParentKeyOffset = 0; RootKeyCell->NumberOfSubKeys = 0; @@ -147,13 +147,7 @@ CmiVerifyKeyCell(PKEY_CELL KeyCell) assert(KeyCell->Id == REG_KEY_CELL_ID); } - if ((KeyCell->Type != REG_KEY_CELL_TYPE) - && (KeyCell->Type != REG_ROOT_KEY_CELL_TYPE)) - { - DbgPrint("Type is %.08x (should be %.08x or %.08x)\n", - KeyCell->Type, REG_KEY_CELL_TYPE, REG_ROOT_KEY_CELL_TYPE); - assert(FALSE); - } + //KeyCell->Flags; //KeyCell->LastWriteTime; @@ -207,11 +201,11 @@ CmiVerifyRootKeyCell(PKEY_CELL RootKeyCell) CmiVerifyKeyCell(RootKeyCell); - if (RootKeyCell->Type != REG_ROOT_KEY_CELL_TYPE) + if (!(RootKeyCell->Flags & REG_KEY_ROOT_CELL)) { DbgPrint("Type is %.08x (should be %.08x)\n", - RootKeyCell->Type, REG_ROOT_KEY_CELL_TYPE); - assert(RootKeyCell->Type == REG_ROOT_KEY_CELL_TYPE); + RootKeyCell->Flags, REG_KEY_ROOT_CELL | REG_KEY_NAME_PACKED); + assert(!(RootKeyCell->Type & REG_KEY_ROOT_CELL)); } } @@ -2136,7 +2130,7 @@ CmiAddSubKey(PREGISTRY_HIVE RegistryHive, else { NewKeyCell->Id = REG_KEY_CELL_ID; - NewKeyCell->Type = REG_KEY_CELL_TYPE; + NewKeyCell->Flags = REG_KEY_NAME_PACKED; ZwQuerySystemTime((PTIME) &NewKeyCell->LastWriteTime); NewKeyCell->ParentKeyOffset = -1; NewKeyCell->NumberOfSubKeys = 0; diff --git a/reactos/ntoskrnl/cm/regobj.c b/reactos/ntoskrnl/cm/regobj.c index 27944d55767..5df30cd24af 100644 --- a/reactos/ntoskrnl/cm/regobj.c +++ b/reactos/ntoskrnl/cm/regobj.c @@ -91,7 +91,7 @@ CmiObjectParse(PVOID ParsedObject, return(STATUS_UNSUCCESSFUL); } - if ((SubKeyCell->Type == REG_LINK_KEY_CELL_TYPE) && + if ((SubKeyCell->Flags & REG_KEY_LINK_CELL) && !((Attributes & OBJ_OPENLINK) && (EndPtr == NULL) /*(end == NULL)*/)) { RtlInitUnicodeString(&LinkPath, NULL); @@ -156,7 +156,7 @@ CmiObjectParse(PVOID ParsedObject, } else { - if ((FoundObject->KeyCell->Type == REG_LINK_KEY_CELL_TYPE) && + if ((FoundObject->KeyCell->Flags & REG_KEY_LINK_CELL) && !((Attributes & OBJ_OPENLINK) && (EndPtr == NULL)/*(end == NULL)*/)) { DPRINT("Found link\n");