mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
- KEY_CELL => CM_KEY_NODE
svn path=/trunk/; revision=23573
This commit is contained in:
parent
a627f5639b
commit
aa9cca267c
9 changed files with 266 additions and 262 deletions
|
@ -67,16 +67,16 @@ CmiAllocateHashTableCell (PHHIVE Hive,
|
|||
|
||||
static BOOLEAN
|
||||
CmiAddKeyToParentHashTable (PHHIVE Hive,
|
||||
HCELL_INDEX ParentKeyOffset,
|
||||
PKEY_CELL NewKeyCell,
|
||||
HCELL_INDEX Parent,
|
||||
PCM_KEY_NODE NewKeyCell,
|
||||
HCELL_INDEX NKBOffset)
|
||||
{
|
||||
PHASH_TABLE_CELL HashBlock;
|
||||
PKEY_CELL ParentKeyCell;
|
||||
PCM_KEY_NODE ParentKeyCell;
|
||||
ULONG i;
|
||||
|
||||
ParentKeyCell = HvGetCell (Hive, ParentKeyOffset);
|
||||
HashBlock = HvGetCell (Hive, ParentKeyCell->HashTableOffset[HvStable]);
|
||||
ParentKeyCell = HvGetCell (Hive, Parent);
|
||||
HashBlock = HvGetCell (Hive, ParentKeyCell->SubKeyLists[HvStable]);
|
||||
|
||||
for (i = 0; i < HashBlock->HashTableSize; i++)
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ CmiAddKeyToParentHashTable (PHHIVE Hive,
|
|||
memcpy (&HashBlock->Table[i].HashValue,
|
||||
NewKeyCell->Name,
|
||||
min(NewKeyCell->NameSize, sizeof(ULONG)));
|
||||
ParentKeyCell->NumberOfSubKeys[HvStable]++;
|
||||
ParentKeyCell->SubKeyCounts[HvStable]++;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ CmiAddValueToKeyValueList(PHHIVE Hive,
|
|||
HCELL_INDEX ValueCellOffset)
|
||||
{
|
||||
PVALUE_LIST_CELL ValueListCell;
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
|
||||
KeyCell = HvGetCell (Hive, KeyCellOffset);
|
||||
if (KeyCell == NULL)
|
||||
|
@ -189,15 +189,15 @@ CmiAddValueToKeyValueList(PHHIVE Hive,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
ValueListCell = HvGetCell (Hive, KeyCell->ValueListOffset);
|
||||
ValueListCell = HvGetCell (Hive, KeyCell->ValueList.List);
|
||||
if (ValueListCell == NULL)
|
||||
{
|
||||
DbgPrint((DPRINT_REGISTRY, "HvGetCell() failed\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ValueListCell->ValueOffset[KeyCell->NumberOfValues] = ValueCellOffset;
|
||||
KeyCell->NumberOfValues++;
|
||||
ValueListCell->ValueOffset[KeyCell->ValueList.Count] = ValueCellOffset;
|
||||
KeyCell->ValueList.Count++;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -278,12 +278,12 @@ CmiExportValue (PHHIVE Hive,
|
|||
|
||||
static BOOLEAN
|
||||
CmiExportSubKey (PHHIVE Hive,
|
||||
HCELL_INDEX ParentKeyOffset,
|
||||
HCELL_INDEX Parent,
|
||||
FRLDRHKEY ParentKey,
|
||||
FRLDRHKEY Key)
|
||||
{
|
||||
HCELL_INDEX NKBOffset;
|
||||
PKEY_CELL NewKeyCell;
|
||||
PCM_KEY_NODE NewKeyCell;
|
||||
ULONG KeyCellSize;
|
||||
ULONG SubKeyCount;
|
||||
ULONG ValueCount;
|
||||
|
@ -312,7 +312,7 @@ CmiExportSubKey (PHHIVE Hive,
|
|||
}
|
||||
|
||||
/* Allocate key cell */
|
||||
KeyCellSize = sizeof(KEY_CELL) + NameSize;
|
||||
KeyCellSize = sizeof(CM_KEY_NODE) + NameSize;
|
||||
NKBOffset = HvAllocateCell (Hive, KeyCellSize, HvStable);
|
||||
if (NKBOffset == HCELL_NULL)
|
||||
{
|
||||
|
@ -321,15 +321,15 @@ CmiExportSubKey (PHHIVE Hive,
|
|||
}
|
||||
|
||||
/* Initialize key cell */
|
||||
NewKeyCell = (PKEY_CELL) HvGetCell (Hive, NKBOffset);
|
||||
NewKeyCell = (PCM_KEY_NODE) HvGetCell (Hive, NKBOffset);
|
||||
NewKeyCell->Id = REG_KEY_CELL_ID;
|
||||
NewKeyCell->Flags = 0;
|
||||
NewKeyCell->LastWriteTime.QuadPart = 0ULL;
|
||||
NewKeyCell->ParentKeyOffset = ParentKeyOffset;
|
||||
NewKeyCell->NumberOfSubKeys[HvStable] = 0;
|
||||
NewKeyCell->HashTableOffset[HvStable] = -1;
|
||||
NewKeyCell->NumberOfValues = 0;
|
||||
NewKeyCell->ValueListOffset = -1;
|
||||
NewKeyCell->Parent = Parent;
|
||||
NewKeyCell->SubKeyCounts[HvStable] = 0;
|
||||
NewKeyCell->SubKeyLists[HvStable] = -1;
|
||||
NewKeyCell->ValueList.Count = 0;
|
||||
NewKeyCell->ValueList.List = -1;
|
||||
NewKeyCell->SecurityKeyOffset = -1;
|
||||
NewKeyCell->ClassNameOffset = -1;
|
||||
NewKeyCell->NameSize = NameSize;
|
||||
|
@ -352,7 +352,7 @@ CmiExportSubKey (PHHIVE Hive,
|
|||
|
||||
/* Add key cell to the parent key's hash table */
|
||||
if (!CmiAddKeyToParentHashTable (Hive,
|
||||
ParentKeyOffset,
|
||||
Parent,
|
||||
NewKeyCell,
|
||||
NKBOffset))
|
||||
{
|
||||
|
@ -366,7 +366,7 @@ CmiExportSubKey (PHHIVE Hive,
|
|||
{
|
||||
/* Allocate value list cell */
|
||||
if (!CmiAllocateValueListCell (Hive,
|
||||
&NewKeyCell->ValueListOffset,
|
||||
&NewKeyCell->ValueList.List,
|
||||
ValueCount))
|
||||
{
|
||||
DbgPrint((DPRINT_REGISTRY, "CmiAllocateValueListCell() failed\n"));
|
||||
|
@ -400,7 +400,7 @@ CmiExportSubKey (PHHIVE Hive,
|
|||
{
|
||||
/* Allocate hash table cell */
|
||||
if (!CmiAllocateHashTableCell (Hive,
|
||||
&NewKeyCell->HashTableOffset[HvStable],
|
||||
&NewKeyCell->SubKeyLists[HvStable],
|
||||
SubKeyCount))
|
||||
{
|
||||
DbgPrint((DPRINT_REGISTRY, "CmiAllocateHashTableCell() failed\n"));
|
||||
|
@ -430,7 +430,7 @@ static BOOLEAN
|
|||
CmiExportHive (PHHIVE Hive,
|
||||
PCWSTR KeyName)
|
||||
{
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
FRLDRHKEY Key;
|
||||
ULONG SubKeyCount;
|
||||
ULONG ValueCount;
|
||||
|
@ -459,7 +459,7 @@ CmiExportHive (PHHIVE Hive,
|
|||
{
|
||||
/* Allocate value list cell */
|
||||
if (!CmiAllocateValueListCell (Hive,
|
||||
&KeyCell->ValueListOffset,
|
||||
&KeyCell->ValueList.List,
|
||||
ValueCount))
|
||||
{
|
||||
DbgPrint((DPRINT_REGISTRY, "CmiAllocateValueListCell() failed\n"));
|
||||
|
@ -493,7 +493,7 @@ CmiExportHive (PHHIVE Hive,
|
|||
{
|
||||
/* Allocate hash table cell */
|
||||
if (!CmiAllocateHashTableCell (Hive,
|
||||
&KeyCell->HashTableOffset[HvStable],
|
||||
&KeyCell->SubKeyLists[HvStable],
|
||||
SubKeyCount))
|
||||
{
|
||||
DbgPrint((DPRINT_REGISTRY, "CmiAllocateHashTableCell() failed\n"));
|
||||
|
@ -600,11 +600,11 @@ RegImportValue (PHHIVE Hive,
|
|||
|
||||
static BOOLEAN
|
||||
RegImportSubKey(PHHIVE Hive,
|
||||
PKEY_CELL KeyCell,
|
||||
PCM_KEY_NODE KeyCell,
|
||||
FRLDRHKEY ParentKey)
|
||||
{
|
||||
PHASH_TABLE_CELL HashCell;
|
||||
PKEY_CELL SubKeyCell;
|
||||
PCM_KEY_NODE SubKeyCell;
|
||||
PVALUE_LIST_CELL ValueListCell;
|
||||
PVALUE_CELL ValueCell = NULL;
|
||||
PWCHAR wName;
|
||||
|
@ -651,16 +651,16 @@ RegImportSubKey(PHHIVE Hive,
|
|||
DbgPrint((DPRINT_REGISTRY, "RegCreateKey() failed!\n"));
|
||||
return FALSE;
|
||||
}
|
||||
DbgPrint((DPRINT_REGISTRY, "Subkeys: %u\n", KeyCell->NumberOfSubKeys));
|
||||
DbgPrint((DPRINT_REGISTRY, "Values: %u\n", KeyCell->NumberOfValues));
|
||||
DbgPrint((DPRINT_REGISTRY, "Subkeys: %u\n", KeyCell->SubKeyCounts));
|
||||
DbgPrint((DPRINT_REGISTRY, "Values: %u\n", KeyCell->ValueList.Count));
|
||||
|
||||
/* Enumerate and add values */
|
||||
if (KeyCell->NumberOfValues > 0)
|
||||
if (KeyCell->ValueList.Count > 0)
|
||||
{
|
||||
ValueListCell = (PVALUE_LIST_CELL) HvGetCell (Hive, KeyCell->ValueListOffset);
|
||||
ValueListCell = (PVALUE_LIST_CELL) HvGetCell (Hive, KeyCell->ValueList.List);
|
||||
DbgPrint((DPRINT_REGISTRY, "ValueListCell: %x\n", ValueListCell));
|
||||
|
||||
for (i = 0; i < KeyCell->NumberOfValues; i++)
|
||||
for (i = 0; i < KeyCell->ValueList.Count; i++)
|
||||
{
|
||||
DbgPrint((DPRINT_REGISTRY, "ValueOffset[%d]: %x\n", i, ValueListCell->ValueOffset[i]));
|
||||
|
||||
|
@ -674,17 +674,17 @@ RegImportSubKey(PHHIVE Hive,
|
|||
}
|
||||
|
||||
/* Enumerate and add subkeys */
|
||||
if (KeyCell->NumberOfSubKeys[HvStable] > 0)
|
||||
if (KeyCell->SubKeyCounts[HvStable] > 0)
|
||||
{
|
||||
HashCell = (PHASH_TABLE_CELL) HvGetCell (Hive, KeyCell->HashTableOffset[HvStable]);
|
||||
HashCell = (PHASH_TABLE_CELL) HvGetCell (Hive, KeyCell->SubKeyLists[HvStable]);
|
||||
DbgPrint((DPRINT_REGISTRY, "HashCell: %x\n", HashCell));
|
||||
DbgPrint((DPRINT_REGISTRY, "NumberOfSubKeys: %x\n", KeyCell->NumberOfSubKeys));
|
||||
DbgPrint((DPRINT_REGISTRY, "SubKeyCounts: %x\n", KeyCell->SubKeyCounts));
|
||||
|
||||
for (i = 0; i < KeyCell->NumberOfSubKeys[HvStable]; i++)
|
||||
for (i = 0; i < KeyCell->SubKeyCounts[HvStable]; i++)
|
||||
{
|
||||
DbgPrint((DPRINT_REGISTRY, "KeyOffset[%d]: %x\n", i, HashCell->Table[i].KeyOffset));
|
||||
|
||||
SubKeyCell = (PKEY_CELL) HvGetCell (Hive, HashCell->Table[i].KeyOffset);
|
||||
SubKeyCell = (PCM_KEY_NODE) HvGetCell (Hive, HashCell->Table[i].KeyOffset);
|
||||
|
||||
DbgPrint((DPRINT_REGISTRY, "SubKeyCell[%d]: %x\n", i, SubKeyCell));
|
||||
|
||||
|
@ -701,9 +701,9 @@ BOOLEAN
|
|||
RegImportBinaryHive(PCHAR ChunkBase,
|
||||
ULONG ChunkSize)
|
||||
{
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
PHASH_TABLE_CELL HashCell;
|
||||
PKEY_CELL SubKeyCell;
|
||||
PCM_KEY_NODE SubKeyCell;
|
||||
FRLDRHKEY SystemKey;
|
||||
ULONG i;
|
||||
LONG Error;
|
||||
|
@ -731,8 +731,8 @@ RegImportBinaryHive(PCHAR ChunkBase,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
DbgPrint((DPRINT_REGISTRY, "Subkeys: %u\n", KeyCell->NumberOfSubKeys));
|
||||
DbgPrint((DPRINT_REGISTRY, "Values: %u\n", KeyCell->NumberOfValues));
|
||||
DbgPrint((DPRINT_REGISTRY, "Subkeys: %u\n", KeyCell->SubKeyCounts));
|
||||
DbgPrint((DPRINT_REGISTRY, "Values: %u\n", KeyCell->ValueList.Count));
|
||||
|
||||
/* Open 'System' key */
|
||||
Error = RegOpenKey(NULL,
|
||||
|
@ -745,13 +745,13 @@ RegImportBinaryHive(PCHAR ChunkBase,
|
|||
}
|
||||
|
||||
/* Enumerate and add subkeys */
|
||||
if (KeyCell->NumberOfSubKeys[HvStable] > 0)
|
||||
if (KeyCell->SubKeyCounts[HvStable] > 0)
|
||||
{
|
||||
HashCell = HvGetCell (Hive, KeyCell->HashTableOffset[HvStable]);
|
||||
HashCell = HvGetCell (Hive, KeyCell->SubKeyLists[HvStable]);
|
||||
DbgPrint((DPRINT_REGISTRY, "HashCell: %x\n", HashCell));
|
||||
DbgPrint((DPRINT_REGISTRY, "NumberOfSubKeys: %x\n", KeyCell->NumberOfSubKeys[HvStable]));
|
||||
DbgPrint((DPRINT_REGISTRY, "SubKeyCounts: %x\n", KeyCell->SubKeyCounts[HvStable]));
|
||||
|
||||
for (i = 0; i < KeyCell->NumberOfSubKeys[HvStable]; i++)
|
||||
for (i = 0; i < KeyCell->SubKeyCounts[HvStable]; i++)
|
||||
{
|
||||
DbgPrint((DPRINT_REGISTRY, "KeyOffset[%d]: %x\n", i, HashCell->Table[i].KeyOffset));
|
||||
|
||||
|
|
|
@ -31,7 +31,13 @@ typedef struct _CM_VIEW_OF_FILE
|
|||
ULONG UseCount;
|
||||
} CM_VIEW_OF_FILE, *PCM_VIEW_OF_FILE;
|
||||
|
||||
typedef struct _KEY_CELL
|
||||
typedef struct _CHILD_LIST
|
||||
{
|
||||
ULONG Count;
|
||||
HCELL_INDEX List;
|
||||
} CHILD_LIST, *PCHILD_LIST;
|
||||
|
||||
typedef struct _CM_KEY_NODE
|
||||
{
|
||||
/* Key cell identifier "kn" (0x6b6e) */
|
||||
USHORT Id;
|
||||
|
@ -42,23 +48,18 @@ typedef struct _KEY_CELL
|
|||
/* Time of last flush */
|
||||
LARGE_INTEGER LastWriteTime;
|
||||
|
||||
/* ? */
|
||||
ULONG UnUsed1;
|
||||
ULONG Spare;
|
||||
|
||||
/* BlockAddress offset of parent key cell */
|
||||
HCELL_INDEX ParentKeyOffset;
|
||||
HCELL_INDEX Parent;
|
||||
|
||||
/* Count of sub keys for the key in this key cell (stable & volatile) */
|
||||
ULONG NumberOfSubKeys[HvMaxStorageType];
|
||||
ULONG SubKeyCounts[HvMaxStorageType];
|
||||
|
||||
/* BlockAddress offset of has table for FIXME: subkeys/values? (stable & volatile) */
|
||||
HCELL_INDEX HashTableOffset[HvMaxStorageType];
|
||||
HCELL_INDEX SubKeyLists[HvMaxStorageType];
|
||||
|
||||
/* Count of values contained in this key cell */
|
||||
ULONG NumberOfValues;
|
||||
|
||||
/* BlockAddress offset of VALUE_LIST_CELL */
|
||||
HCELL_INDEX ValueListOffset;
|
||||
CHILD_LIST ValueList;
|
||||
|
||||
/* BlockAddress offset of security cell */
|
||||
HCELL_INDEX SecurityKeyOffset;
|
||||
|
@ -66,8 +67,11 @@ typedef struct _KEY_CELL
|
|||
/* BlockAddress offset of registry key class */
|
||||
HCELL_INDEX ClassNameOffset;
|
||||
|
||||
/* ? */
|
||||
ULONG Unused4[5];
|
||||
ULONG MaxNameLen;
|
||||
ULONG MaxClassLen;
|
||||
ULONG MaxValueNameLen;
|
||||
ULONG MaxValueDataLen;
|
||||
ULONG WorkVar;
|
||||
|
||||
/* Size in bytes of key name */
|
||||
USHORT NameSize;
|
||||
|
@ -77,9 +81,9 @@ typedef struct _KEY_CELL
|
|||
|
||||
/* Name of key (not zero terminated) */
|
||||
UCHAR Name[0];
|
||||
} KEY_CELL, *PKEY_CELL;
|
||||
} CM_KEY_NODE, *PCM_KEY_NODE;
|
||||
|
||||
/* KEY_CELL.Flags constants */
|
||||
/* CM_KEY_NODE.Flags constants */
|
||||
#define REG_KEY_VOLATILE_CELL 0x01
|
||||
#define REG_KEY_ROOT_CELL 0x0C
|
||||
#define REG_KEY_LINK_CELL 0x10
|
||||
|
|
|
@ -12,29 +12,29 @@ CmCreateRootNode(
|
|||
PHHIVE Hive,
|
||||
PCWSTR Name)
|
||||
{
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
HCELL_INDEX RootCellIndex;
|
||||
ULONG NameSize;
|
||||
|
||||
NameSize = wcslen(Name) * sizeof(WCHAR);
|
||||
RootCellIndex = HvAllocateCell(Hive, sizeof(KEY_CELL) + NameSize, HvStable);
|
||||
RootCellIndex = HvAllocateCell(Hive, sizeof(CM_KEY_NODE) + NameSize, HvStable);
|
||||
if (RootCellIndex == HCELL_NULL)
|
||||
return FALSE;
|
||||
|
||||
Hive->HiveHeader->RootCell = RootCellIndex;
|
||||
Hive->HiveHeader->Checksum = HvpHiveHeaderChecksum(Hive->HiveHeader);
|
||||
|
||||
KeyCell = (PKEY_CELL)HvGetCell(Hive, RootCellIndex);
|
||||
KeyCell = (PCM_KEY_NODE)HvGetCell(Hive, RootCellIndex);
|
||||
KeyCell->Id = REG_KEY_CELL_ID;
|
||||
KeyCell->Flags = REG_KEY_ROOT_CELL;
|
||||
KeyCell->LastWriteTime.QuadPart = 0;
|
||||
KeyCell->ParentKeyOffset = HCELL_NULL;
|
||||
KeyCell->NumberOfSubKeys[0] = 0;
|
||||
KeyCell->NumberOfSubKeys[1] = 0;
|
||||
KeyCell->HashTableOffset[0] = HCELL_NULL;
|
||||
KeyCell->HashTableOffset[1] = HCELL_NULL;
|
||||
KeyCell->NumberOfValues = 0;
|
||||
KeyCell->ValueListOffset = HCELL_NULL;
|
||||
KeyCell->Parent = HCELL_NULL;
|
||||
KeyCell->SubKeyCounts[0] = 0;
|
||||
KeyCell->SubKeyCounts[1] = 0;
|
||||
KeyCell->SubKeyLists[0] = HCELL_NULL;
|
||||
KeyCell->SubKeyLists[1] = HCELL_NULL;
|
||||
KeyCell->ValueList.Count = 0;
|
||||
KeyCell->ValueList.List = HCELL_NULL;
|
||||
KeyCell->SecurityKeyOffset = HCELL_NULL;
|
||||
KeyCell->ClassNameOffset = HCELL_NULL;
|
||||
KeyCell->NameSize = NameSize;
|
||||
|
@ -47,23 +47,23 @@ CmCreateRootNode(
|
|||
static VOID CMAPI
|
||||
CmpPrepareKey(
|
||||
PHHIVE RegistryHive,
|
||||
PKEY_CELL KeyCell)
|
||||
PCM_KEY_NODE KeyCell)
|
||||
{
|
||||
PKEY_CELL SubKeyCell;
|
||||
PCM_KEY_NODE SubKeyCell;
|
||||
PHASH_TABLE_CELL HashCell;
|
||||
ULONG i;
|
||||
|
||||
ASSERT(KeyCell->Id == REG_KEY_CELL_ID);
|
||||
|
||||
KeyCell->HashTableOffset[HvVolatile] = HCELL_NULL;
|
||||
KeyCell->NumberOfSubKeys[HvVolatile] = 0;
|
||||
KeyCell->SubKeyLists[HvVolatile] = HCELL_NULL;
|
||||
KeyCell->SubKeyCounts[HvVolatile] = 0;
|
||||
|
||||
/* Enumerate and add subkeys */
|
||||
if (KeyCell->NumberOfSubKeys[HvStable] > 0)
|
||||
if (KeyCell->SubKeyCounts[HvStable] > 0)
|
||||
{
|
||||
HashCell = HvGetCell(RegistryHive, KeyCell->HashTableOffset[HvStable]);
|
||||
HashCell = HvGetCell(RegistryHive, KeyCell->SubKeyLists[HvStable]);
|
||||
|
||||
for (i = 0; i < KeyCell->NumberOfSubKeys[HvStable]; i++)
|
||||
for (i = 0; i < KeyCell->SubKeyCounts[HvStable]; i++)
|
||||
{
|
||||
SubKeyCell = HvGetCell(RegistryHive, HashCell->Table[i].KeyOffset);
|
||||
CmpPrepareKey(RegistryHive, SubKeyCell);
|
||||
|
@ -75,7 +75,7 @@ VOID CMAPI
|
|||
CmPrepareHive(
|
||||
PHHIVE RegistryHive)
|
||||
{
|
||||
PKEY_CELL RootCell;
|
||||
PCM_KEY_NODE RootCell;
|
||||
|
||||
RootCell = HvGetCell(RegistryHive, RegistryHive->HiveHeader->RootCell);
|
||||
CmpPrepareKey(RegistryHive, RootCell);
|
||||
|
|
|
@ -77,7 +77,7 @@ typedef struct _HBASE_BLOCK
|
|||
ULONG Format;
|
||||
|
||||
/* Offset into file from the byte after the end of the base block.
|
||||
If the hive is volatile, this is the actual pointer to the KEY_CELL */
|
||||
If the hive is volatile, this is the actual pointer to the CM_KEY_NODE */
|
||||
HCELL_INDEX RootCell;
|
||||
|
||||
/* Size of each hive block ? */
|
||||
|
|
|
@ -85,8 +85,8 @@ typedef struct _KEY_OBJECT
|
|||
/* Block offset of the key cell this key belongs in */
|
||||
HCELL_INDEX KeyCellOffset;
|
||||
|
||||
/* KEY_CELL this key belong in */
|
||||
PKEY_CELL KeyCell;
|
||||
/* CM_KEY_NODE this key belong in */
|
||||
PCM_KEY_NODE KeyCell;
|
||||
|
||||
/* Link to the parent KEY_OBJECT for this key */
|
||||
struct _KEY_OBJECT *ParentKey;
|
||||
|
@ -95,7 +95,7 @@ typedef struct _KEY_OBJECT
|
|||
LIST_ENTRY ListEntry;
|
||||
|
||||
/* Subkeys loaded in SubKeys */
|
||||
ULONG NumberOfSubKeys;
|
||||
ULONG SubKeyCounts;
|
||||
|
||||
/* Space allocated in SubKeys */
|
||||
ULONG SizeOfSubKeys;
|
||||
|
@ -236,16 +236,16 @@ CmiGetMaxClassLength(IN PKEY_OBJECT KeyObject);
|
|||
|
||||
ULONG
|
||||
CmiGetMaxValueNameLength(IN PEREGISTRY_HIVE RegistryHive,
|
||||
IN PKEY_CELL KeyCell);
|
||||
IN PCM_KEY_NODE KeyCell);
|
||||
|
||||
ULONG
|
||||
CmiGetMaxValueDataLength(IN PEREGISTRY_HIVE RegistryHive,
|
||||
IN PKEY_CELL KeyCell);
|
||||
IN PCM_KEY_NODE KeyCell);
|
||||
|
||||
NTSTATUS
|
||||
CmiScanForSubKey(IN PEREGISTRY_HIVE RegistryHive,
|
||||
IN PKEY_CELL KeyCell,
|
||||
OUT PKEY_CELL *SubKeyCell,
|
||||
IN PCM_KEY_NODE KeyCell,
|
||||
OUT PCM_KEY_NODE *SubKeyCell,
|
||||
OUT HCELL_INDEX *BlockOffset,
|
||||
IN PUNICODE_STRING KeyName,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
|
@ -267,20 +267,20 @@ CmiRemoveSubKey(IN PEREGISTRY_HIVE RegistryHive,
|
|||
|
||||
NTSTATUS
|
||||
CmiScanKeyForValue(IN PEREGISTRY_HIVE RegistryHive,
|
||||
IN PKEY_CELL KeyCell,
|
||||
IN PCM_KEY_NODE KeyCell,
|
||||
IN PUNICODE_STRING ValueName,
|
||||
OUT PVALUE_CELL *ValueCell,
|
||||
OUT HCELL_INDEX *VBOffset);
|
||||
|
||||
NTSTATUS
|
||||
CmiGetValueFromKeyByIndex(IN PEREGISTRY_HIVE RegistryHive,
|
||||
IN PKEY_CELL KeyCell,
|
||||
IN PCM_KEY_NODE KeyCell,
|
||||
IN ULONG Index,
|
||||
OUT PVALUE_CELL *ValueCell);
|
||||
|
||||
NTSTATUS
|
||||
CmiAddValueToKey(IN PEREGISTRY_HIVE RegistryHive,
|
||||
IN PKEY_CELL KeyCell,
|
||||
IN PCM_KEY_NODE KeyCell,
|
||||
IN HCELL_INDEX KeyCellOffset,
|
||||
IN PUNICODE_STRING ValueName,
|
||||
OUT PVALUE_CELL *pValueCell,
|
||||
|
@ -288,7 +288,7 @@ CmiAddValueToKey(IN PEREGISTRY_HIVE RegistryHive,
|
|||
|
||||
NTSTATUS
|
||||
CmiDeleteValueFromKey(IN PEREGISTRY_HIVE RegistryHive,
|
||||
IN PKEY_CELL KeyCell,
|
||||
IN PCM_KEY_NODE KeyCell,
|
||||
IN HCELL_INDEX KeyCellOffset,
|
||||
IN PUNICODE_STRING ValueName);
|
||||
|
||||
|
@ -299,7 +299,7 @@ CmiAllocateHashTableCell(IN PEREGISTRY_HIVE RegistryHive,
|
|||
IN ULONG HashTableSize,
|
||||
IN HV_STORAGE_TYPE Storage);
|
||||
|
||||
PKEY_CELL
|
||||
PCM_KEY_NODE
|
||||
CmiGetKeyFromHashByIndex(PEREGISTRY_HIVE RegistryHive,
|
||||
PHASH_TABLE_CELL HashBlock,
|
||||
ULONG Index);
|
||||
|
@ -307,9 +307,9 @@ CmiGetKeyFromHashByIndex(PEREGISTRY_HIVE RegistryHive,
|
|||
NTSTATUS
|
||||
CmiAddKeyToHashTable(PEREGISTRY_HIVE RegistryHive,
|
||||
PHASH_TABLE_CELL HashCell,
|
||||
PKEY_CELL KeyCell,
|
||||
PCM_KEY_NODE KeyCell,
|
||||
HV_STORAGE_TYPE StorageType,
|
||||
PKEY_CELL NewKeyCell,
|
||||
PCM_KEY_NODE NewKeyCell,
|
||||
HCELL_INDEX NKBOffset);
|
||||
|
||||
NTSTATUS
|
||||
|
@ -365,11 +365,11 @@ CmiCompareHashI(PUNICODE_STRING KeyName,
|
|||
|
||||
BOOLEAN
|
||||
CmiCompareKeyNames(PUNICODE_STRING KeyName,
|
||||
PKEY_CELL KeyCell);
|
||||
PCM_KEY_NODE KeyCell);
|
||||
|
||||
BOOLEAN
|
||||
CmiCompareKeyNamesI(PUNICODE_STRING KeyName,
|
||||
PKEY_CELL KeyCell);
|
||||
PCM_KEY_NODE KeyCell);
|
||||
|
||||
|
||||
VOID
|
||||
|
@ -381,9 +381,9 @@ CmiCreateTempHive(PEREGISTRY_HIVE *RegistryHive);
|
|||
|
||||
NTSTATUS
|
||||
CmiCopyKey (PEREGISTRY_HIVE DstHive,
|
||||
PKEY_CELL DstKeyCell,
|
||||
PCM_KEY_NODE DstKeyCell,
|
||||
PEREGISTRY_HIVE SrcHive,
|
||||
PKEY_CELL SrcKeyCell);
|
||||
PCM_KEY_NODE SrcKeyCell);
|
||||
|
||||
NTSTATUS
|
||||
CmiSaveTempHive (PEREGISTRY_HIVE Hive,
|
||||
|
|
|
@ -487,7 +487,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
KeyObject->ParentKey = Object;
|
||||
KeyObject->RegistryHive = KeyObject->ParentKey->RegistryHive;
|
||||
KeyObject->Flags = 0;
|
||||
KeyObject->NumberOfSubKeys = 0;
|
||||
KeyObject->SubKeyCounts = 0;
|
||||
KeyObject->SizeOfSubKeys = 0;
|
||||
KeyObject->SubKeys = NULL;
|
||||
|
||||
|
@ -531,7 +531,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
RtlpCreateUnicodeString(&KeyObject->Name, Start, NonPagedPool);
|
||||
}
|
||||
|
||||
KeyObject->KeyCell->ParentKeyOffset = KeyObject->ParentKey->KeyCellOffset;
|
||||
KeyObject->KeyCell->Parent = KeyObject->ParentKey->KeyCellOffset;
|
||||
KeyObject->KeyCell->SecurityKeyOffset = KeyObject->ParentKey->KeyCell->SecurityKeyOffset;
|
||||
|
||||
DPRINT("RemainingPath: %wZ\n", &RemainingPath);
|
||||
|
@ -628,8 +628,8 @@ NtDeleteKey(IN HANDLE KeyHandle)
|
|||
VERIFY_KEY_OBJECT(KeyObject);
|
||||
|
||||
/* Check for subkeys */
|
||||
if (KeyObject->KeyCell->NumberOfSubKeys[HvStable] != 0 ||
|
||||
KeyObject->KeyCell->NumberOfSubKeys[HvVolatile] != 0)
|
||||
if (KeyObject->KeyCell->SubKeyCounts[HvStable] != 0 ||
|
||||
KeyObject->KeyCell->SubKeyCounts[HvVolatile] != 0)
|
||||
{
|
||||
Status = STATUS_CANNOT_DELETE;
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ NtEnumerateKey(IN HANDLE KeyHandle,
|
|||
{
|
||||
PKEY_OBJECT KeyObject;
|
||||
PEREGISTRY_HIVE RegistryHive;
|
||||
PKEY_CELL KeyCell, SubKeyCell;
|
||||
PCM_KEY_NODE KeyCell, SubKeyCell;
|
||||
PHASH_TABLE_CELL HashTableBlock;
|
||||
PKEY_BASIC_INFORMATION BasicInformation;
|
||||
PKEY_NODE_INFORMATION NodeInformation;
|
||||
|
@ -746,8 +746,8 @@ NtEnumerateKey(IN HANDLE KeyHandle,
|
|||
RegistryHive = KeyObject->RegistryHive;
|
||||
|
||||
/* Check for hightest possible sub key index */
|
||||
if (Index >= KeyCell->NumberOfSubKeys[HvStable] +
|
||||
KeyCell->NumberOfSubKeys[HvVolatile])
|
||||
if (Index >= KeyCell->SubKeyCounts[HvStable] +
|
||||
KeyCell->SubKeyCounts[HvVolatile])
|
||||
{
|
||||
ExReleaseResourceLite(&CmiRegistryLock);
|
||||
KeLeaveCriticalRegion();
|
||||
|
@ -759,10 +759,10 @@ NtEnumerateKey(IN HANDLE KeyHandle,
|
|||
}
|
||||
|
||||
/* Get pointer to SubKey */
|
||||
if (Index >= KeyCell->NumberOfSubKeys[HvStable])
|
||||
if (Index >= KeyCell->SubKeyCounts[HvStable])
|
||||
{
|
||||
Storage = HvVolatile;
|
||||
BaseIndex = Index - KeyCell->NumberOfSubKeys[HvStable];
|
||||
BaseIndex = Index - KeyCell->SubKeyCounts[HvStable];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -770,7 +770,7 @@ NtEnumerateKey(IN HANDLE KeyHandle,
|
|||
BaseIndex = Index;
|
||||
}
|
||||
|
||||
if (KeyCell->HashTableOffset[Storage] == HCELL_NULL)
|
||||
if (KeyCell->SubKeyLists[Storage] == HCELL_NULL)
|
||||
{
|
||||
ExReleaseResourceLite(&CmiRegistryLock);
|
||||
KeLeaveCriticalRegion();
|
||||
|
@ -780,8 +780,8 @@ NtEnumerateKey(IN HANDLE KeyHandle,
|
|||
return STATUS_NO_MORE_ENTRIES;
|
||||
}
|
||||
|
||||
ASSERT(KeyCell->HashTableOffset[Storage] != HCELL_NULL);
|
||||
HashTableBlock = HvGetCell (RegistryHive->Hive, KeyCell->HashTableOffset[Storage]);
|
||||
ASSERT(KeyCell->SubKeyLists[Storage] != HCELL_NULL);
|
||||
HashTableBlock = HvGetCell (RegistryHive->Hive, KeyCell->SubKeyLists[Storage]);
|
||||
|
||||
SubKeyCell = CmiGetKeyFromHashByIndex(RegistryHive,
|
||||
HashTableBlock,
|
||||
|
@ -929,10 +929,10 @@ NtEnumerateKey(IN HANDLE KeyHandle,
|
|||
FullInformation->ClassOffset = sizeof(KEY_FULL_INFORMATION) -
|
||||
sizeof(WCHAR);
|
||||
FullInformation->ClassLength = SubKeyCell->ClassSize;
|
||||
FullInformation->SubKeys = CmiGetNumberOfSubKeys(KeyObject); //SubKeyCell->NumberOfSubKeys;
|
||||
FullInformation->SubKeys = CmiGetNumberOfSubKeys(KeyObject); //SubKeyCell->SubKeyCounts;
|
||||
FullInformation->MaxNameLen = CmiGetMaxNameLength(KeyObject);
|
||||
FullInformation->MaxClassLen = CmiGetMaxClassLength(KeyObject);
|
||||
FullInformation->Values = SubKeyCell->NumberOfValues;
|
||||
FullInformation->Values = SubKeyCell->ValueList.Count;
|
||||
FullInformation->MaxValueNameLen =
|
||||
CmiGetMaxValueNameLength(RegistryHive, SubKeyCell);
|
||||
FullInformation->MaxValueDataLen =
|
||||
|
@ -986,7 +986,7 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
|
|||
NTSTATUS Status;
|
||||
PKEY_OBJECT KeyObject;
|
||||
PEREGISTRY_HIVE RegistryHive;
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
PVALUE_CELL ValueCell;
|
||||
PVOID DataCell;
|
||||
ULONG NameSize, DataSize;
|
||||
|
@ -1441,7 +1441,7 @@ NtQueryKey(IN HANDLE KeyHandle,
|
|||
PEREGISTRY_HIVE RegistryHive;
|
||||
PVOID ClassCell;
|
||||
PKEY_OBJECT KeyObject;
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
ULONG NameSize, ClassSize;
|
||||
NTSTATUS Status;
|
||||
REG_QUERY_KEY_INFORMATION QueryKeyInfo;
|
||||
|
@ -1603,10 +1603,10 @@ NtQueryKey(IN HANDLE KeyHandle,
|
|||
FullInformation->TitleIndex = 0;
|
||||
FullInformation->ClassOffset = sizeof(KEY_FULL_INFORMATION) - sizeof(WCHAR);
|
||||
FullInformation->ClassLength = KeyCell->ClassSize;
|
||||
FullInformation->SubKeys = CmiGetNumberOfSubKeys(KeyObject); //KeyCell->NumberOfSubKeys;
|
||||
FullInformation->SubKeys = CmiGetNumberOfSubKeys(KeyObject); //KeyCell->SubKeyCounts;
|
||||
FullInformation->MaxNameLen = CmiGetMaxNameLength(KeyObject);
|
||||
FullInformation->MaxClassLen = CmiGetMaxClassLength(KeyObject);
|
||||
FullInformation->Values = KeyCell->NumberOfValues;
|
||||
FullInformation->Values = KeyCell->ValueList.Count;
|
||||
FullInformation->MaxValueNameLen =
|
||||
CmiGetMaxValueNameLength(RegistryHive, KeyCell);
|
||||
FullInformation->MaxValueDataLen =
|
||||
|
@ -1666,7 +1666,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
|
|||
ULONG NameSize, DataSize;
|
||||
PKEY_OBJECT KeyObject;
|
||||
PEREGISTRY_HIVE RegistryHive;
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
PVALUE_CELL ValueCell;
|
||||
PVOID DataCell;
|
||||
PKEY_VALUE_BASIC_INFORMATION ValueBasicInformation;
|
||||
|
@ -1926,7 +1926,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
|||
NTSTATUS Status;
|
||||
PKEY_OBJECT KeyObject;
|
||||
PEREGISTRY_HIVE RegistryHive;
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
PVALUE_CELL ValueCell;
|
||||
HCELL_INDEX ValueCellOffset;
|
||||
PVOID DataCell;
|
||||
|
@ -2378,7 +2378,7 @@ NtQueryMultipleValueKey (IN HANDLE KeyHandle,
|
|||
PKEY_OBJECT KeyObject;
|
||||
PVOID DataCell;
|
||||
ULONG BufferLength = 0;
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
NTSTATUS Status;
|
||||
PUCHAR DataPtr;
|
||||
ULONG i;
|
||||
|
|
|
@ -832,7 +832,7 @@ CmiFlushRegistryHive(PEREGISTRY_HIVE RegistryHive)
|
|||
ULONG
|
||||
CmiGetNumberOfSubKeys(PKEY_OBJECT KeyObject)
|
||||
{
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
ULONG SubKeyCount;
|
||||
|
||||
VERIFY_KEY_OBJECT(KeyObject);
|
||||
|
@ -841,8 +841,8 @@ CmiGetNumberOfSubKeys(PKEY_OBJECT KeyObject)
|
|||
VERIFY_KEY_CELL(KeyCell);
|
||||
|
||||
SubKeyCount = (KeyCell == NULL) ? 0 :
|
||||
KeyCell->NumberOfSubKeys[HvStable] +
|
||||
KeyCell->NumberOfSubKeys[HvVolatile];
|
||||
KeyCell->SubKeyCounts[HvStable] +
|
||||
KeyCell->SubKeyCounts[HvVolatile];
|
||||
|
||||
return SubKeyCount;
|
||||
}
|
||||
|
@ -852,8 +852,8 @@ ULONG
|
|||
CmiGetMaxNameLength(PKEY_OBJECT KeyObject)
|
||||
{
|
||||
PHASH_TABLE_CELL HashBlock;
|
||||
PKEY_CELL CurSubKeyCell;
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE CurSubKeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
ULONG MaxName;
|
||||
ULONG NameSize;
|
||||
ULONG i;
|
||||
|
@ -867,12 +867,12 @@ CmiGetMaxNameLength(PKEY_OBJECT KeyObject)
|
|||
MaxName = 0;
|
||||
for (Storage = HvStable; Storage < HvMaxStorageType; Storage++)
|
||||
{
|
||||
if (KeyCell->HashTableOffset[Storage] != HCELL_NULL)
|
||||
if (KeyCell->SubKeyLists[Storage] != HCELL_NULL)
|
||||
{
|
||||
HashBlock = HvGetCell (KeyObject->RegistryHive->Hive, KeyCell->HashTableOffset[Storage]);
|
||||
HashBlock = HvGetCell (KeyObject->RegistryHive->Hive, KeyCell->SubKeyLists[Storage]);
|
||||
ASSERT(HashBlock->Id == REG_HASH_TABLE_CELL_ID);
|
||||
|
||||
for (i = 0; i < KeyCell->NumberOfSubKeys[Storage]; i++)
|
||||
for (i = 0; i < KeyCell->SubKeyCounts[Storage]; i++)
|
||||
{
|
||||
CurSubKeyCell = HvGetCell (KeyObject->RegistryHive->Hive,
|
||||
HashBlock->Table[i].KeyOffset);
|
||||
|
@ -895,8 +895,8 @@ ULONG
|
|||
CmiGetMaxClassLength(PKEY_OBJECT KeyObject)
|
||||
{
|
||||
PHASH_TABLE_CELL HashBlock;
|
||||
PKEY_CELL CurSubKeyCell;
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE CurSubKeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
ULONG MaxClass;
|
||||
ULONG i;
|
||||
ULONG Storage;
|
||||
|
@ -909,13 +909,13 @@ CmiGetMaxClassLength(PKEY_OBJECT KeyObject)
|
|||
MaxClass = 0;
|
||||
for (Storage = HvStable; Storage < HvMaxStorageType; Storage++)
|
||||
{
|
||||
if (KeyCell->HashTableOffset[Storage] != HCELL_NULL)
|
||||
if (KeyCell->SubKeyLists[Storage] != HCELL_NULL)
|
||||
{
|
||||
HashBlock = HvGetCell (KeyObject->RegistryHive->Hive,
|
||||
KeyCell->HashTableOffset[Storage]);
|
||||
KeyCell->SubKeyLists[Storage]);
|
||||
ASSERT(HashBlock->Id == REG_HASH_TABLE_CELL_ID);
|
||||
|
||||
for (i = 0; i < KeyCell->NumberOfSubKeys[Storage]; i++)
|
||||
for (i = 0; i < KeyCell->SubKeyCounts[Storage]; i++)
|
||||
{
|
||||
CurSubKeyCell = HvGetCell (KeyObject->RegistryHive->Hive,
|
||||
HashBlock->Table[i].KeyOffset);
|
||||
|
@ -934,7 +934,7 @@ CmiGetMaxClassLength(PKEY_OBJECT KeyObject)
|
|||
|
||||
ULONG
|
||||
CmiGetMaxValueNameLength(PEREGISTRY_HIVE RegistryHive,
|
||||
PKEY_CELL KeyCell)
|
||||
PCM_KEY_NODE KeyCell)
|
||||
{
|
||||
PVALUE_LIST_CELL ValueListCell;
|
||||
PVALUE_CELL CurValueCell;
|
||||
|
@ -944,16 +944,16 @@ CmiGetMaxValueNameLength(PEREGISTRY_HIVE RegistryHive,
|
|||
|
||||
VERIFY_KEY_CELL(KeyCell);
|
||||
|
||||
if (KeyCell->ValueListOffset == HCELL_NULL)
|
||||
if (KeyCell->ValueList.List == HCELL_NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
MaxValueName = 0;
|
||||
ValueListCell = HvGetCell (RegistryHive->Hive,
|
||||
KeyCell->ValueListOffset);
|
||||
KeyCell->ValueList.List);
|
||||
|
||||
for (i = 0; i < KeyCell->NumberOfValues; i++)
|
||||
for (i = 0; i < KeyCell->ValueList.Count; i++)
|
||||
{
|
||||
CurValueCell = HvGetCell (RegistryHive->Hive,
|
||||
ValueListCell->ValueOffset[i]);
|
||||
|
@ -982,7 +982,7 @@ CmiGetMaxValueNameLength(PEREGISTRY_HIVE RegistryHive,
|
|||
|
||||
ULONG
|
||||
CmiGetMaxValueDataLength(PEREGISTRY_HIVE RegistryHive,
|
||||
PKEY_CELL KeyCell)
|
||||
PCM_KEY_NODE KeyCell)
|
||||
{
|
||||
PVALUE_LIST_CELL ValueListCell;
|
||||
PVALUE_CELL CurValueCell;
|
||||
|
@ -991,15 +991,15 @@ CmiGetMaxValueDataLength(PEREGISTRY_HIVE RegistryHive,
|
|||
|
||||
VERIFY_KEY_CELL(KeyCell);
|
||||
|
||||
if (KeyCell->ValueListOffset == HCELL_NULL)
|
||||
if (KeyCell->ValueList.List == HCELL_NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
MaxValueData = 0;
|
||||
ValueListCell = HvGetCell (RegistryHive->Hive, KeyCell->ValueListOffset);
|
||||
ValueListCell = HvGetCell (RegistryHive->Hive, KeyCell->ValueList.List);
|
||||
|
||||
for (i = 0; i < KeyCell->NumberOfValues; i++)
|
||||
for (i = 0; i < KeyCell->ValueList.Count; i++)
|
||||
{
|
||||
CurValueCell = HvGetCell (RegistryHive->Hive,
|
||||
ValueListCell->ValueOffset[i]);
|
||||
|
@ -1015,15 +1015,15 @@ CmiGetMaxValueDataLength(PEREGISTRY_HIVE RegistryHive,
|
|||
|
||||
NTSTATUS
|
||||
CmiScanForSubKey(IN PEREGISTRY_HIVE RegistryHive,
|
||||
IN PKEY_CELL KeyCell,
|
||||
OUT PKEY_CELL *SubKeyCell,
|
||||
IN PCM_KEY_NODE KeyCell,
|
||||
OUT PCM_KEY_NODE *SubKeyCell,
|
||||
OUT HCELL_INDEX *BlockOffset,
|
||||
IN PUNICODE_STRING KeyName,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN ULONG Attributes)
|
||||
{
|
||||
PHASH_TABLE_CELL HashBlock;
|
||||
PKEY_CELL CurSubKeyCell;
|
||||
PCM_KEY_NODE CurSubKeyCell;
|
||||
ULONG Storage;
|
||||
ULONG i;
|
||||
|
||||
|
@ -1038,16 +1038,16 @@ CmiScanForSubKey(IN PEREGISTRY_HIVE RegistryHive,
|
|||
for (Storage = HvStable; Storage < HvMaxStorageType; Storage++)
|
||||
{
|
||||
/* The key does not have any subkeys */
|
||||
if (KeyCell->HashTableOffset[Storage] == HCELL_NULL)
|
||||
if (KeyCell->SubKeyLists[Storage] == HCELL_NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Get hash table */
|
||||
HashBlock = HvGetCell (RegistryHive->Hive, KeyCell->HashTableOffset[Storage]);
|
||||
HashBlock = HvGetCell (RegistryHive->Hive, KeyCell->SubKeyLists[Storage]);
|
||||
ASSERT(HashBlock->Id == REG_HASH_TABLE_CELL_ID);
|
||||
|
||||
for (i = 0; i < KeyCell->NumberOfSubKeys[Storage]; i++)
|
||||
for (i = 0; i < KeyCell->SubKeyCounts[Storage]; i++)
|
||||
{
|
||||
if (Attributes & OBJ_CASE_INSENSITIVE)
|
||||
{
|
||||
|
@ -1099,9 +1099,9 @@ CmiAddSubKey(PEREGISTRY_HIVE RegistryHive,
|
|||
{
|
||||
PHASH_TABLE_CELL HashBlock;
|
||||
HCELL_INDEX NKBOffset;
|
||||
PKEY_CELL NewKeyCell;
|
||||
PCM_KEY_NODE NewKeyCell;
|
||||
ULONG NewBlockSize;
|
||||
PKEY_CELL ParentKeyCell;
|
||||
PCM_KEY_NODE ParentKeyCell;
|
||||
PVOID ClassCell;
|
||||
NTSTATUS Status;
|
||||
USHORT NameSize;
|
||||
|
@ -1148,7 +1148,7 @@ CmiAddSubKey(PEREGISTRY_HIVE RegistryHive,
|
|||
Status = STATUS_SUCCESS;
|
||||
|
||||
Storage = (CreateOptions & REG_OPTION_VOLATILE) ? HvVolatile : HvStable;
|
||||
NewBlockSize = sizeof(KEY_CELL) + NameSize;
|
||||
NewBlockSize = sizeof(CM_KEY_NODE) + NameSize;
|
||||
NKBOffset = HvAllocateCell (RegistryHive->Hive, NewBlockSize, Storage);
|
||||
if (NKBOffset == HCELL_NULL)
|
||||
{
|
||||
|
@ -1167,13 +1167,13 @@ CmiAddSubKey(PEREGISTRY_HIVE RegistryHive,
|
|||
NewKeyCell->Flags = 0;
|
||||
}
|
||||
KeQuerySystemTime(&NewKeyCell->LastWriteTime);
|
||||
NewKeyCell->ParentKeyOffset = HCELL_NULL;
|
||||
NewKeyCell->NumberOfSubKeys[HvStable] = 0;
|
||||
NewKeyCell->NumberOfSubKeys[HvVolatile] = 0;
|
||||
NewKeyCell->HashTableOffset[HvStable] = HCELL_NULL;
|
||||
NewKeyCell->HashTableOffset[HvVolatile] = HCELL_NULL;
|
||||
NewKeyCell->NumberOfValues = 0;
|
||||
NewKeyCell->ValueListOffset = HCELL_NULL;
|
||||
NewKeyCell->Parent = HCELL_NULL;
|
||||
NewKeyCell->SubKeyCounts[HvStable] = 0;
|
||||
NewKeyCell->SubKeyCounts[HvVolatile] = 0;
|
||||
NewKeyCell->SubKeyLists[HvStable] = HCELL_NULL;
|
||||
NewKeyCell->SubKeyLists[HvVolatile] = HCELL_NULL;
|
||||
NewKeyCell->ValueList.Count = 0;
|
||||
NewKeyCell->ValueList.List = HCELL_NULL;
|
||||
NewKeyCell->SecurityKeyOffset = HCELL_NULL;
|
||||
NewKeyCell->ClassNameOffset = HCELL_NULL;
|
||||
|
||||
|
@ -1218,11 +1218,11 @@ CmiAddSubKey(PEREGISTRY_HIVE RegistryHive,
|
|||
SubKey->KeyCell = NewKeyCell;
|
||||
SubKey->KeyCellOffset = NKBOffset;
|
||||
|
||||
if (ParentKeyCell->HashTableOffset[Storage] == HCELL_NULL)
|
||||
if (ParentKeyCell->SubKeyLists[Storage] == HCELL_NULL)
|
||||
{
|
||||
Status = CmiAllocateHashTableCell (RegistryHive,
|
||||
&HashBlock,
|
||||
&ParentKeyCell->HashTableOffset[Storage],
|
||||
&ParentKeyCell->SubKeyLists[Storage],
|
||||
REG_INIT_HASH_TABLE_SIZE,
|
||||
Storage);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -1233,10 +1233,10 @@ CmiAddSubKey(PEREGISTRY_HIVE RegistryHive,
|
|||
else
|
||||
{
|
||||
HashBlock = HvGetCell (RegistryHive->Hive,
|
||||
ParentKeyCell->HashTableOffset[Storage]);
|
||||
ParentKeyCell->SubKeyLists[Storage]);
|
||||
ASSERT(HashBlock->Id == REG_HASH_TABLE_CELL_ID);
|
||||
|
||||
if (((ParentKeyCell->NumberOfSubKeys[Storage] + 1) >= HashBlock->HashTableSize))
|
||||
if (((ParentKeyCell->SubKeyCounts[Storage] + 1) >= HashBlock->HashTableSize))
|
||||
{
|
||||
PHASH_TABLE_CELL NewHashBlock;
|
||||
HCELL_INDEX HTOffset;
|
||||
|
@ -1258,8 +1258,8 @@ CmiAddSubKey(PEREGISTRY_HIVE RegistryHive,
|
|||
RtlCopyMemory(&NewHashBlock->Table[0],
|
||||
&HashBlock->Table[0],
|
||||
sizeof(NewHashBlock->Table[0]) * HashBlock->HashTableSize);
|
||||
HvFreeCell (RegistryHive->Hive, ParentKeyCell->HashTableOffset[Storage]);
|
||||
ParentKeyCell->HashTableOffset[Storage] = HTOffset;
|
||||
HvFreeCell (RegistryHive->Hive, ParentKeyCell->SubKeyLists[Storage]);
|
||||
ParentKeyCell->SubKeyLists[Storage] = HTOffset;
|
||||
HashBlock = NewHashBlock;
|
||||
}
|
||||
}
|
||||
|
@ -1272,7 +1272,7 @@ CmiAddSubKey(PEREGISTRY_HIVE RegistryHive,
|
|||
NKBOffset);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
ParentKeyCell->NumberOfSubKeys[Storage]++;
|
||||
ParentKeyCell->SubKeyCounts[Storage]++;
|
||||
}
|
||||
|
||||
KeQuerySystemTime (&ParentKeyCell->LastWriteTime);
|
||||
|
@ -1298,13 +1298,13 @@ CmiRemoveSubKey(PEREGISTRY_HIVE RegistryHive,
|
|||
Storage = (SubKey->KeyCell->Flags & REG_KEY_VOLATILE_CELL) ? HvVolatile : HvStable;
|
||||
|
||||
/* Remove all values */
|
||||
if (SubKey->KeyCell->NumberOfValues != 0)
|
||||
if (SubKey->KeyCell->ValueList.Count != 0)
|
||||
{
|
||||
/* Get pointer to the value list cell */
|
||||
ValueList = HvGetCell (RegistryHive->Hive, SubKey->KeyCell->ValueListOffset);
|
||||
ValueList = HvGetCell (RegistryHive->Hive, SubKey->KeyCell->ValueList.List);
|
||||
|
||||
/* Enumerate all values */
|
||||
for (i = 0; i < SubKey->KeyCell->NumberOfValues; i++)
|
||||
for (i = 0; i < SubKey->KeyCell->ValueList.Count; i++)
|
||||
{
|
||||
/* Get pointer to value cell */
|
||||
ValueCell = HvGetCell(RegistryHive->Hive,
|
||||
|
@ -1323,51 +1323,51 @@ CmiRemoveSubKey(PEREGISTRY_HIVE RegistryHive,
|
|||
}
|
||||
|
||||
/* Destroy value list cell */
|
||||
HvFreeCell (RegistryHive->Hive, SubKey->KeyCell->ValueListOffset);
|
||||
HvFreeCell (RegistryHive->Hive, SubKey->KeyCell->ValueList.List);
|
||||
|
||||
SubKey->KeyCell->NumberOfValues = 0;
|
||||
SubKey->KeyCell->ValueListOffset = (HCELL_INDEX)-1;
|
||||
SubKey->KeyCell->ValueList.Count = 0;
|
||||
SubKey->KeyCell->ValueList.List = (HCELL_INDEX)-1;
|
||||
|
||||
HvMarkCellDirty(RegistryHive->Hive, SubKey->KeyCellOffset);
|
||||
}
|
||||
|
||||
/* Remove the key from the parent key's hash block */
|
||||
if (ParentKey->KeyCell->HashTableOffset[Storage] != HCELL_NULL)
|
||||
if (ParentKey->KeyCell->SubKeyLists[Storage] != HCELL_NULL)
|
||||
{
|
||||
DPRINT("ParentKey HashTableOffset %lx\n", ParentKey->KeyCell->HashTableOffset[Storage]);
|
||||
DPRINT("ParentKey SubKeyLists %lx\n", ParentKey->KeyCell->SubKeyLists[Storage]);
|
||||
HashBlock = HvGetCell (ParentKey->RegistryHive->Hive,
|
||||
ParentKey->KeyCell->HashTableOffset[Storage]);
|
||||
ParentKey->KeyCell->SubKeyLists[Storage]);
|
||||
ASSERT(HashBlock->Id == REG_HASH_TABLE_CELL_ID);
|
||||
DPRINT("ParentKey HashBlock %p\n", HashBlock);
|
||||
CmiRemoveKeyFromHashTable(ParentKey->RegistryHive,
|
||||
HashBlock,
|
||||
SubKey->KeyCellOffset);
|
||||
HvMarkCellDirty(ParentKey->RegistryHive->Hive,
|
||||
ParentKey->KeyCell->HashTableOffset[Storage]);
|
||||
ParentKey->KeyCell->SubKeyLists[Storage]);
|
||||
}
|
||||
|
||||
/* Remove the key's hash block */
|
||||
if (SubKey->KeyCell->HashTableOffset[Storage] != HCELL_NULL)
|
||||
if (SubKey->KeyCell->SubKeyLists[Storage] != HCELL_NULL)
|
||||
{
|
||||
DPRINT("SubKey HashTableOffset %lx\n", SubKey->KeyCell->HashTableOffset[Storage]);
|
||||
HvFreeCell (RegistryHive->Hive, SubKey->KeyCell->HashTableOffset[Storage]);
|
||||
SubKey->KeyCell->HashTableOffset[Storage] = HCELL_NULL;
|
||||
DPRINT("SubKey SubKeyLists %lx\n", SubKey->KeyCell->SubKeyLists[Storage]);
|
||||
HvFreeCell (RegistryHive->Hive, SubKey->KeyCell->SubKeyLists[Storage]);
|
||||
SubKey->KeyCell->SubKeyLists[Storage] = HCELL_NULL;
|
||||
}
|
||||
|
||||
/* Decrement the number of the parent key's sub keys */
|
||||
if (ParentKey != NULL)
|
||||
{
|
||||
DPRINT("ParentKey %p\n", ParentKey);
|
||||
ParentKey->KeyCell->NumberOfSubKeys[Storage]--;
|
||||
ParentKey->KeyCell->SubKeyCounts[Storage]--;
|
||||
|
||||
/* Remove the parent key's hash table */
|
||||
if (ParentKey->KeyCell->NumberOfSubKeys[Storage] == 0 &&
|
||||
ParentKey->KeyCell->HashTableOffset[Storage] != HCELL_NULL)
|
||||
if (ParentKey->KeyCell->SubKeyCounts[Storage] == 0 &&
|
||||
ParentKey->KeyCell->SubKeyLists[Storage] != HCELL_NULL)
|
||||
{
|
||||
DPRINT("ParentKey HashTableOffset %lx\n", ParentKey->KeyCell->HashTableOffset);
|
||||
DPRINT("ParentKey SubKeyLists %lx\n", ParentKey->KeyCell->SubKeyLists);
|
||||
HvFreeCell (ParentKey->RegistryHive->Hive,
|
||||
ParentKey->KeyCell->HashTableOffset[Storage]);
|
||||
ParentKey->KeyCell->HashTableOffset[Storage] = HCELL_NULL;
|
||||
ParentKey->KeyCell->SubKeyLists[Storage]);
|
||||
ParentKey->KeyCell->SubKeyLists[Storage] = HCELL_NULL;
|
||||
}
|
||||
|
||||
KeQuerySystemTime(&ParentKey->KeyCell->LastWriteTime);
|
||||
|
@ -1388,7 +1388,7 @@ CmiRemoveSubKey(PEREGISTRY_HIVE RegistryHive,
|
|||
|
||||
NTSTATUS
|
||||
CmiScanKeyForValue(IN PEREGISTRY_HIVE RegistryHive,
|
||||
IN PKEY_CELL KeyCell,
|
||||
IN PCM_KEY_NODE KeyCell,
|
||||
IN PUNICODE_STRING ValueName,
|
||||
OUT PVALUE_CELL *ValueCell,
|
||||
OUT HCELL_INDEX *ValueCellOffset)
|
||||
|
@ -1402,16 +1402,16 @@ CmiScanKeyForValue(IN PEREGISTRY_HIVE RegistryHive,
|
|||
*ValueCellOffset = (HCELL_INDEX)-1;
|
||||
|
||||
/* The key does not have any values */
|
||||
if (KeyCell->ValueListOffset == (HCELL_INDEX)-1)
|
||||
if (KeyCell->ValueList.List == (HCELL_INDEX)-1)
|
||||
{
|
||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
||||
ValueListCell = HvGetCell (RegistryHive->Hive, KeyCell->ValueListOffset);
|
||||
ValueListCell = HvGetCell (RegistryHive->Hive, KeyCell->ValueList.List);
|
||||
|
||||
VERIFY_VALUE_LIST_CELL(ValueListCell);
|
||||
|
||||
for (i = 0; i < KeyCell->NumberOfValues; i++)
|
||||
for (i = 0; i < KeyCell->ValueList.Count; i++)
|
||||
{
|
||||
CurValueCell = HvGetCell (RegistryHive->Hive,
|
||||
ValueListCell->ValueOffset[i]);
|
||||
|
@ -1435,7 +1435,7 @@ CmiScanKeyForValue(IN PEREGISTRY_HIVE RegistryHive,
|
|||
|
||||
NTSTATUS
|
||||
CmiGetValueFromKeyByIndex(IN PEREGISTRY_HIVE RegistryHive,
|
||||
IN PKEY_CELL KeyCell,
|
||||
IN PCM_KEY_NODE KeyCell,
|
||||
IN ULONG Index,
|
||||
OUT PVALUE_CELL *ValueCell)
|
||||
{
|
||||
|
@ -1444,18 +1444,18 @@ CmiGetValueFromKeyByIndex(IN PEREGISTRY_HIVE RegistryHive,
|
|||
|
||||
*ValueCell = NULL;
|
||||
|
||||
if (KeyCell->ValueListOffset == (HCELL_INDEX)-1)
|
||||
if (KeyCell->ValueList.List == (HCELL_INDEX)-1)
|
||||
{
|
||||
return STATUS_NO_MORE_ENTRIES;
|
||||
}
|
||||
|
||||
if (Index >= KeyCell->NumberOfValues)
|
||||
if (Index >= KeyCell->ValueList.Count)
|
||||
{
|
||||
return STATUS_NO_MORE_ENTRIES;
|
||||
}
|
||||
|
||||
|
||||
ValueListCell = HvGetCell (RegistryHive->Hive, KeyCell->ValueListOffset);
|
||||
ValueListCell = HvGetCell (RegistryHive->Hive, KeyCell->ValueList.List);
|
||||
|
||||
VERIFY_VALUE_LIST_CELL(ValueListCell);
|
||||
|
||||
|
@ -1469,7 +1469,7 @@ CmiGetValueFromKeyByIndex(IN PEREGISTRY_HIVE RegistryHive,
|
|||
|
||||
NTSTATUS
|
||||
CmiAddValueToKey(IN PEREGISTRY_HIVE RegistryHive,
|
||||
IN PKEY_CELL KeyCell,
|
||||
IN PCM_KEY_NODE KeyCell,
|
||||
IN HCELL_INDEX KeyCellOffset,
|
||||
IN PUNICODE_STRING ValueName,
|
||||
OUT PVALUE_CELL *pValueCell,
|
||||
|
@ -1483,10 +1483,10 @@ CmiAddValueToKey(IN PEREGISTRY_HIVE RegistryHive,
|
|||
HV_STORAGE_TYPE Storage;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("KeyCell->ValuesOffset %lu\n", (ULONG)KeyCell->ValueListOffset);
|
||||
DPRINT("KeyCell->ValuesOffset %lu\n", (ULONG)KeyCell->ValueList.List);
|
||||
|
||||
Storage = (KeyCell->Flags & REG_KEY_VOLATILE_CELL) ? HvVolatile : HvStable;
|
||||
if (KeyCell->ValueListOffset == HCELL_NULL)
|
||||
if (KeyCell->ValueList.List == HCELL_NULL)
|
||||
{
|
||||
CellSize = sizeof(VALUE_LIST_CELL) +
|
||||
(3 * sizeof(HCELL_INDEX));
|
||||
|
@ -1497,33 +1497,33 @@ CmiAddValueToKey(IN PEREGISTRY_HIVE RegistryHive,
|
|||
}
|
||||
|
||||
ValueListCell = HvGetCell (RegistryHive->Hive, ValueListCellOffset);
|
||||
KeyCell->ValueListOffset = ValueListCellOffset;
|
||||
KeyCell->ValueList.List = ValueListCellOffset;
|
||||
HvMarkCellDirty(RegistryHive->Hive, KeyCellOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
ValueListCell = (PVALUE_LIST_CELL) HvGetCell (RegistryHive->Hive, KeyCell->ValueListOffset);
|
||||
ValueListCell = (PVALUE_LIST_CELL) HvGetCell (RegistryHive->Hive, KeyCell->ValueList.List);
|
||||
CellSize = ABS_VALUE(HvGetCellSize(RegistryHive->Hive, ValueListCell));
|
||||
|
||||
if (KeyCell->NumberOfValues >=
|
||||
if (KeyCell->ValueList.Count >=
|
||||
(CellSize / sizeof(HCELL_INDEX)))
|
||||
{
|
||||
CellSize *= 2;
|
||||
ValueListCellOffset = HvReallocateCell (RegistryHive->Hive, KeyCell->ValueListOffset, CellSize);
|
||||
ValueListCellOffset = HvReallocateCell (RegistryHive->Hive, KeyCell->ValueList.List, CellSize);
|
||||
if (ValueListCellOffset == HCELL_NULL)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
ValueListCell = HvGetCell (RegistryHive->Hive, ValueListCellOffset);
|
||||
KeyCell->ValueListOffset = ValueListCellOffset;
|
||||
KeyCell->ValueList.List = ValueListCellOffset;
|
||||
HvMarkCellDirty (RegistryHive->Hive, KeyCellOffset);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
DPRINT("KeyCell->NumberOfValues %lu, ValueListCell->CellSize %lu (%lu %lx)\n",
|
||||
KeyCell->NumberOfValues,
|
||||
DPRINT("KeyCell->ValueList.Count %lu, ValueListCell->CellSize %lu (%lu %lx)\n",
|
||||
KeyCell->ValueList.Count,
|
||||
(ULONG)ABS_VALUE(ValueListCell->CellSize),
|
||||
((ULONG)ABS_VALUE(ValueListCell->CellSize) - sizeof(CELL_HEADER)) / sizeof(HCELL_INDEX),
|
||||
((ULONG)ABS_VALUE(ValueListCell->CellSize) - sizeof(CELL_HEADER)) / sizeof(HCELL_INDEX));
|
||||
|
@ -1539,11 +1539,11 @@ CmiAddValueToKey(IN PEREGISTRY_HIVE RegistryHive,
|
|||
return Status;
|
||||
}
|
||||
|
||||
ValueListCell->ValueOffset[KeyCell->NumberOfValues] = NewValueCellOffset;
|
||||
KeyCell->NumberOfValues++;
|
||||
ValueListCell->ValueOffset[KeyCell->ValueList.Count] = NewValueCellOffset;
|
||||
KeyCell->ValueList.Count++;
|
||||
|
||||
HvMarkCellDirty(RegistryHive->Hive, KeyCellOffset);
|
||||
HvMarkCellDirty(RegistryHive->Hive, KeyCell->ValueListOffset);
|
||||
HvMarkCellDirty(RegistryHive->Hive, KeyCell->ValueList.List);
|
||||
HvMarkCellDirty(RegistryHive->Hive, NewValueCellOffset);
|
||||
|
||||
*pValueCell = NewValueCell;
|
||||
|
@ -1555,7 +1555,7 @@ CmiAddValueToKey(IN PEREGISTRY_HIVE RegistryHive,
|
|||
|
||||
NTSTATUS
|
||||
CmiDeleteValueFromKey(IN PEREGISTRY_HIVE RegistryHive,
|
||||
IN PKEY_CELL KeyCell,
|
||||
IN PCM_KEY_NODE KeyCell,
|
||||
IN HCELL_INDEX KeyCellOffset,
|
||||
IN PUNICODE_STRING ValueName)
|
||||
{
|
||||
|
@ -1564,16 +1564,16 @@ CmiDeleteValueFromKey(IN PEREGISTRY_HIVE RegistryHive,
|
|||
ULONG i;
|
||||
NTSTATUS Status;
|
||||
|
||||
if (KeyCell->ValueListOffset == -1)
|
||||
if (KeyCell->ValueList.List == -1)
|
||||
{
|
||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
||||
ValueListCell = HvGetCell (RegistryHive->Hive, KeyCell->ValueListOffset);
|
||||
ValueListCell = HvGetCell (RegistryHive->Hive, KeyCell->ValueList.List);
|
||||
|
||||
VERIFY_VALUE_LIST_CELL(ValueListCell);
|
||||
|
||||
for (i = 0; i < KeyCell->NumberOfValues; i++)
|
||||
for (i = 0; i < KeyCell->ValueList.Count; i++)
|
||||
{
|
||||
CurValueCell = HvGetCell (RegistryHive->Hive, ValueListCell->ValueOffset[i]);
|
||||
|
||||
|
@ -1591,26 +1591,26 @@ CmiDeleteValueFromKey(IN PEREGISTRY_HIVE RegistryHive,
|
|||
return Status;
|
||||
}
|
||||
|
||||
if (i < (KeyCell->NumberOfValues - 1))
|
||||
if (i < (KeyCell->ValueList.Count - 1))
|
||||
{
|
||||
RtlMoveMemory(&ValueListCell->ValueOffset[i],
|
||||
&ValueListCell->ValueOffset[i + 1],
|
||||
sizeof(HCELL_INDEX) * (KeyCell->NumberOfValues - 1 - i));
|
||||
sizeof(HCELL_INDEX) * (KeyCell->ValueList.Count - 1 - i));
|
||||
}
|
||||
ValueListCell->ValueOffset[KeyCell->NumberOfValues - 1] = 0;
|
||||
ValueListCell->ValueOffset[KeyCell->ValueList.Count - 1] = 0;
|
||||
|
||||
|
||||
KeyCell->NumberOfValues--;
|
||||
KeyCell->ValueList.Count--;
|
||||
|
||||
if (KeyCell->NumberOfValues == 0)
|
||||
if (KeyCell->ValueList.Count == 0)
|
||||
{
|
||||
HvFreeCell(RegistryHive->Hive, KeyCell->ValueListOffset);
|
||||
KeyCell->ValueListOffset = -1;
|
||||
HvFreeCell(RegistryHive->Hive, KeyCell->ValueList.List);
|
||||
KeyCell->ValueList.List = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
HvMarkCellDirty(RegistryHive->Hive,
|
||||
KeyCell->ValueListOffset);
|
||||
KeyCell->ValueList.List);
|
||||
}
|
||||
|
||||
HvMarkCellDirty(RegistryHive->Hive,
|
||||
|
@ -1660,13 +1660,13 @@ CmiAllocateHashTableCell (IN PEREGISTRY_HIVE RegistryHive,
|
|||
}
|
||||
|
||||
|
||||
PKEY_CELL
|
||||
PCM_KEY_NODE
|
||||
CmiGetKeyFromHashByIndex(PEREGISTRY_HIVE RegistryHive,
|
||||
PHASH_TABLE_CELL HashBlock,
|
||||
ULONG Index)
|
||||
{
|
||||
HCELL_INDEX KeyOffset;
|
||||
PKEY_CELL KeyCell;
|
||||
PCM_KEY_NODE KeyCell;
|
||||
|
||||
KeyOffset = HashBlock->Table[Index].KeyOffset;
|
||||
KeyCell = HvGetCell (RegistryHive->Hive, KeyOffset);
|
||||
|
@ -1678,12 +1678,12 @@ CmiGetKeyFromHashByIndex(PEREGISTRY_HIVE RegistryHive,
|
|||
NTSTATUS
|
||||
CmiAddKeyToHashTable(PEREGISTRY_HIVE RegistryHive,
|
||||
PHASH_TABLE_CELL HashCell,
|
||||
PKEY_CELL KeyCell,
|
||||
PCM_KEY_NODE KeyCell,
|
||||
HV_STORAGE_TYPE StorageType,
|
||||
PKEY_CELL NewKeyCell,
|
||||
PCM_KEY_NODE NewKeyCell,
|
||||
HCELL_INDEX NKBOffset)
|
||||
{
|
||||
ULONG i = KeyCell->NumberOfSubKeys[StorageType];
|
||||
ULONG i = KeyCell->SubKeyCounts[StorageType];
|
||||
|
||||
HashCell->Table[i].KeyOffset = NKBOffset;
|
||||
HashCell->Table[i].HashValue = 0;
|
||||
|
@ -1693,7 +1693,7 @@ CmiAddKeyToHashTable(PEREGISTRY_HIVE RegistryHive,
|
|||
NewKeyCell->Name,
|
||||
min(NewKeyCell->NameSize, sizeof(ULONG)));
|
||||
}
|
||||
HvMarkCellDirty(RegistryHive->Hive, KeyCell->HashTableOffset[StorageType]);
|
||||
HvMarkCellDirty(RegistryHive->Hive, KeyCell->SubKeyLists[StorageType]);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1907,7 +1907,7 @@ CmiCompareHashI(PUNICODE_STRING KeyName,
|
|||
|
||||
BOOLEAN
|
||||
CmiCompareKeyNames(PUNICODE_STRING KeyName,
|
||||
PKEY_CELL KeyCell)
|
||||
PCM_KEY_NODE KeyCell)
|
||||
{
|
||||
PWCHAR UnicodeName;
|
||||
USHORT i;
|
||||
|
@ -1944,7 +1944,7 @@ CmiCompareKeyNames(PUNICODE_STRING KeyName,
|
|||
|
||||
BOOLEAN
|
||||
CmiCompareKeyNamesI(PUNICODE_STRING KeyName,
|
||||
PKEY_CELL KeyCell)
|
||||
PCM_KEY_NODE KeyCell)
|
||||
{
|
||||
PWCHAR UnicodeName;
|
||||
USHORT i;
|
||||
|
@ -1983,11 +1983,11 @@ CmiCompareKeyNamesI(PUNICODE_STRING KeyName,
|
|||
|
||||
NTSTATUS
|
||||
CmiCopyKey (PEREGISTRY_HIVE DstHive,
|
||||
PKEY_CELL DstKeyCell,
|
||||
PCM_KEY_NODE DstKeyCell,
|
||||
PEREGISTRY_HIVE SrcHive,
|
||||
PKEY_CELL SrcKeyCell)
|
||||
PCM_KEY_NODE SrcKeyCell)
|
||||
{
|
||||
PKEY_CELL NewKeyCell;
|
||||
PCM_KEY_NODE NewKeyCell;
|
||||
ULONG NewKeyCellSize;
|
||||
HCELL_INDEX NewKeyCellOffset;
|
||||
PHASH_TABLE_CELL NewHashTableCell;
|
||||
|
@ -2001,7 +2001,7 @@ CmiCopyKey (PEREGISTRY_HIVE DstHive,
|
|||
if (DstKeyCell == NULL)
|
||||
{
|
||||
/* Allocate and copy key cell */
|
||||
NewKeyCellSize = sizeof(KEY_CELL) + SrcKeyCell->NameSize;
|
||||
NewKeyCellSize = sizeof(CM_KEY_NODE) + SrcKeyCell->NameSize;
|
||||
NewKeyCellOffset = HvAllocateCell (DstHive->Hive, NewKeyCellSize, HvStable);
|
||||
if (NewKeyCellOffset == HCELL_NULL)
|
||||
{
|
||||
|
@ -2046,9 +2046,9 @@ CmiCopyKey (PEREGISTRY_HIVE DstHive,
|
|||
}
|
||||
|
||||
/* Allocate hash table */
|
||||
if (SrcKeyCell->NumberOfSubKeys[HvStable] > 0)
|
||||
if (SrcKeyCell->SubKeyCounts[HvStable] > 0)
|
||||
{
|
||||
NewHashTableSize = ROUND_UP(SrcKeyCell->NumberOfSubKeys[HvStable] + 1, 4) - 1;
|
||||
NewHashTableSize = ROUND_UP(SrcKeyCell->SubKeyCounts[HvStable] + 1, 4) - 1;
|
||||
Status = CmiAllocateHashTableCell (DstHive,
|
||||
&NewHashTableCell,
|
||||
&NewHashTableOffset,
|
||||
|
@ -2059,7 +2059,7 @@ CmiCopyKey (PEREGISTRY_HIVE DstHive,
|
|||
DPRINT1 ("CmiAllocateHashTableBlock() failed (Status %lx)\n", Status);
|
||||
return Status;
|
||||
}
|
||||
NewKeyCell->HashTableOffset[HvStable] = NewHashTableOffset;
|
||||
NewKeyCell->SubKeyLists[HvStable] = NewHashTableOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2067,7 +2067,7 @@ CmiCopyKey (PEREGISTRY_HIVE DstHive,
|
|||
}
|
||||
|
||||
/* Allocate and copy value list and values */
|
||||
if (SrcKeyCell->NumberOfValues != 0)
|
||||
if (SrcKeyCell->ValueList.Count != 0)
|
||||
{
|
||||
PVALUE_LIST_CELL NewValueListCell;
|
||||
PVALUE_LIST_CELL SrcValueListCell;
|
||||
|
@ -2082,24 +2082,24 @@ CmiCopyKey (PEREGISTRY_HIVE DstHive,
|
|||
|
||||
|
||||
NewValueListCellSize =
|
||||
ROUND_UP(SrcKeyCell->NumberOfValues, 4) * sizeof(HCELL_INDEX);
|
||||
NewKeyCell->ValueListOffset = HvAllocateCell (DstHive->Hive,
|
||||
ROUND_UP(SrcKeyCell->ValueList.Count, 4) * sizeof(HCELL_INDEX);
|
||||
NewKeyCell->ValueList.List = HvAllocateCell (DstHive->Hive,
|
||||
NewValueListCellSize,
|
||||
HvStable);
|
||||
if (NewKeyCell->ValueListOffset == HCELL_NULL)
|
||||
if (NewKeyCell->ValueList.List == HCELL_NULL)
|
||||
{
|
||||
DPRINT1 ("HvAllocateCell() failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
DPRINT1("KeyCell->ValueListOffset: %x\n", NewKeyCell->ValueListOffset);
|
||||
DPRINT1("KeyCell->ValueList.List: %x\n", NewKeyCell->ValueList.List);
|
||||
|
||||
NewValueListCell = HvGetCell (DstHive->Hive, NewKeyCell->ValueListOffset);
|
||||
NewValueListCell = HvGetCell (DstHive->Hive, NewKeyCell->ValueList.List);
|
||||
RtlZeroMemory (NewValueListCell,
|
||||
NewValueListCellSize);
|
||||
|
||||
/* Copy values */
|
||||
SrcValueListCell = HvGetCell (SrcHive->Hive, SrcKeyCell->ValueListOffset);
|
||||
for (i = 0; i < SrcKeyCell->NumberOfValues; i++)
|
||||
SrcValueListCell = HvGetCell (SrcHive->Hive, SrcKeyCell->ValueList.List);
|
||||
for (i = 0; i < SrcKeyCell->ValueList.Count; i++)
|
||||
{
|
||||
/* Copy value cell */
|
||||
SrcValueCell = HvGetCell (SrcHive->Hive, SrcValueListCell->ValueOffset[i]);
|
||||
|
@ -2139,24 +2139,24 @@ CmiCopyKey (PEREGISTRY_HIVE DstHive,
|
|||
}
|
||||
|
||||
/* Copy subkeys */
|
||||
if (SrcKeyCell->NumberOfSubKeys[HvStable] > 0)
|
||||
if (SrcKeyCell->SubKeyCounts[HvStable] > 0)
|
||||
{
|
||||
PHASH_TABLE_CELL SrcHashTableCell;
|
||||
PKEY_CELL SrcSubKeyCell;
|
||||
PKEY_CELL NewSubKeyCell;
|
||||
PCM_KEY_NODE SrcSubKeyCell;
|
||||
PCM_KEY_NODE NewSubKeyCell;
|
||||
ULONG NewSubKeyCellSize;
|
||||
HCELL_INDEX NewSubKeyCellOffset;
|
||||
PHASH_RECORD SrcHashRecord;
|
||||
|
||||
SrcHashTableCell = HvGetCell (SrcHive->Hive, SrcKeyCell->HashTableOffset[HvStable]);
|
||||
SrcHashTableCell = HvGetCell (SrcHive->Hive, SrcKeyCell->SubKeyLists[HvStable]);
|
||||
|
||||
for (i = 0; i < SrcKeyCell->NumberOfSubKeys[HvStable]; i++)
|
||||
for (i = 0; i < SrcKeyCell->SubKeyCounts[HvStable]; i++)
|
||||
{
|
||||
SrcHashRecord = &SrcHashTableCell->Table[i];
|
||||
SrcSubKeyCell = HvGetCell (SrcHive->Hive, SrcHashRecord->KeyOffset);
|
||||
|
||||
/* Allocate and copy key cell */
|
||||
NewSubKeyCellSize = sizeof(KEY_CELL) + SrcSubKeyCell->NameSize;
|
||||
NewSubKeyCellSize = sizeof(CM_KEY_NODE) + SrcSubKeyCell->NameSize;
|
||||
NewSubKeyCellOffset = HvAllocateCell (DstHive->Hive, NewSubKeyCellSize, HvStable);
|
||||
if (NewSubKeyCellOffset == HCELL_NULL)
|
||||
{
|
||||
|
|
|
@ -255,7 +255,7 @@ CmInitializeRegistry(VOID)
|
|||
RootKey->KeyCell = HvGetCell (CmiVolatileHive->Hive, RootKey->KeyCellOffset);
|
||||
RootKey->ParentKey = RootKey;
|
||||
RootKey->Flags = 0;
|
||||
RootKey->NumberOfSubKeys = 0;
|
||||
RootKey->SubKeyCounts = 0;
|
||||
RootKey->SubKeys = NULL;
|
||||
RootKey->SizeOfSubKeys = 0;
|
||||
InsertTailList(&CmiKeyObjectListHead, &RootKey->ListEntry);
|
||||
|
@ -608,7 +608,7 @@ CmiConnectHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes,
|
|||
NULL);
|
||||
DPRINT("Status %x\n", Status);
|
||||
NewKey->Flags = 0;
|
||||
NewKey->NumberOfSubKeys = 0;
|
||||
NewKey->SubKeyCounts = 0;
|
||||
NewKey->SubKeys = NULL;
|
||||
NewKey->SizeOfSubKeys = 0;
|
||||
InsertTailList(&CmiKeyObjectListHead, &NewKey->ListEntry);
|
||||
|
|
|
@ -23,7 +23,7 @@ extern ULONG CmiTimer;
|
|||
|
||||
static NTSTATUS
|
||||
CmiGetLinkTarget(PEREGISTRY_HIVE RegistryHive,
|
||||
PKEY_CELL KeyCell,
|
||||
PCM_KEY_NODE KeyCell,
|
||||
PUNICODE_STRING TargetPath);
|
||||
|
||||
/* FUNCTONS *****************************************************************/
|
||||
|
@ -240,7 +240,7 @@ CmiObjectParse(IN PVOID ParsedObject,
|
|||
HCELL_INDEX BlockOffset;
|
||||
PKEY_OBJECT FoundObject;
|
||||
PKEY_OBJECT ParsedKey;
|
||||
PKEY_CELL SubKeyCell;
|
||||
PCM_KEY_NODE SubKeyCell;
|
||||
NTSTATUS Status;
|
||||
PWSTR StartPtr;
|
||||
PWSTR EndPtr;
|
||||
|
@ -523,7 +523,7 @@ CmiObjectDelete(PVOID DeletedObject)
|
|||
|
||||
ObDereferenceObject (ParentKeyObject);
|
||||
|
||||
if (KeyObject->NumberOfSubKeys)
|
||||
if (KeyObject->SubKeyCounts)
|
||||
{
|
||||
KEBUGCHECK(REGISTRY_ERROR);
|
||||
}
|
||||
|
@ -766,28 +766,28 @@ CmiAddKeyToList(PKEY_OBJECT ParentKey,
|
|||
DPRINT("ParentKey %.08x\n", ParentKey);
|
||||
|
||||
|
||||
if (ParentKey->SizeOfSubKeys <= ParentKey->NumberOfSubKeys)
|
||||
if (ParentKey->SizeOfSubKeys <= ParentKey->SubKeyCounts)
|
||||
{
|
||||
PKEY_OBJECT *tmpSubKeys = ExAllocatePool(NonPagedPool,
|
||||
(ParentKey->NumberOfSubKeys + 1) * sizeof(ULONG));
|
||||
(ParentKey->SubKeyCounts + 1) * sizeof(ULONG));
|
||||
|
||||
if (ParentKey->NumberOfSubKeys > 0)
|
||||
if (ParentKey->SubKeyCounts > 0)
|
||||
{
|
||||
RtlCopyMemory (tmpSubKeys,
|
||||
ParentKey->SubKeys,
|
||||
ParentKey->NumberOfSubKeys * sizeof(ULONG));
|
||||
ParentKey->SubKeyCounts * sizeof(ULONG));
|
||||
}
|
||||
|
||||
if (ParentKey->SubKeys)
|
||||
ExFreePool(ParentKey->SubKeys);
|
||||
|
||||
ParentKey->SubKeys = tmpSubKeys;
|
||||
ParentKey->SizeOfSubKeys = ParentKey->NumberOfSubKeys + 1;
|
||||
ParentKey->SizeOfSubKeys = ParentKey->SubKeyCounts + 1;
|
||||
}
|
||||
|
||||
/* FIXME: Please maintain the list in alphabetic order */
|
||||
/* to allow a dichotomic search */
|
||||
ParentKey->SubKeys[ParentKey->NumberOfSubKeys++] = NewKey;
|
||||
ParentKey->SubKeys[ParentKey->SubKeyCounts++] = NewKey;
|
||||
|
||||
DPRINT("Reference parent key: 0x%p\n", ParentKey);
|
||||
|
||||
|
@ -807,15 +807,15 @@ CmiRemoveKeyFromList(PKEY_OBJECT KeyToRemove)
|
|||
|
||||
ParentKey = KeyToRemove->ParentKey;
|
||||
/* FIXME: If list maintained in alphabetic order, use dichotomic search */
|
||||
for (Index = 0; Index < ParentKey->NumberOfSubKeys; Index++)
|
||||
for (Index = 0; Index < ParentKey->SubKeyCounts; Index++)
|
||||
{
|
||||
if (ParentKey->SubKeys[Index] == KeyToRemove)
|
||||
{
|
||||
if (Index < ParentKey->NumberOfSubKeys-1)
|
||||
if (Index < ParentKey->SubKeyCounts-1)
|
||||
RtlMoveMemory(&ParentKey->SubKeys[Index],
|
||||
&ParentKey->SubKeys[Index + 1],
|
||||
(ParentKey->NumberOfSubKeys - Index - 1) * sizeof(PKEY_OBJECT));
|
||||
ParentKey->NumberOfSubKeys--;
|
||||
(ParentKey->SubKeyCounts - Index - 1) * sizeof(PKEY_OBJECT));
|
||||
ParentKey->SubKeyCounts--;
|
||||
|
||||
DPRINT("Dereference parent key: 0x%x\n", ParentKey);
|
||||
|
||||
|
@ -841,7 +841,7 @@ CmiScanKeyList(PKEY_OBJECT Parent,
|
|||
KeyName, &Parent->Name);
|
||||
|
||||
/* FIXME: if list maintained in alphabetic order, use dichotomic search */
|
||||
for (Index=0; Index < Parent->NumberOfSubKeys; Index++)
|
||||
for (Index=0; Index < Parent->SubKeyCounts; Index++)
|
||||
{
|
||||
CurKey = Parent->SubKeys[Index];
|
||||
if (Attributes & OBJ_CASE_INSENSITIVE)
|
||||
|
@ -863,7 +863,7 @@ CmiScanKeyList(PKEY_OBJECT Parent,
|
|||
}
|
||||
}
|
||||
|
||||
if (Index < Parent->NumberOfSubKeys)
|
||||
if (Index < Parent->SubKeyCounts)
|
||||
{
|
||||
if (CurKey->Flags & KO_MARKED_FOR_DELETE)
|
||||
{
|
||||
|
@ -884,7 +884,7 @@ CmiScanKeyList(PKEY_OBJECT Parent,
|
|||
|
||||
static NTSTATUS
|
||||
CmiGetLinkTarget(PEREGISTRY_HIVE RegistryHive,
|
||||
PKEY_CELL KeyCell,
|
||||
PCM_KEY_NODE KeyCell,
|
||||
PUNICODE_STRING TargetPath)
|
||||
{
|
||||
UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"SymbolicLinkValue");
|
||||
|
|
Loading…
Reference in a new issue