From 7df1c3d13bf062effc9cb148fb841324928ac98c Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sun, 25 Sep 2005 20:54:40 +0000 Subject: [PATCH] Revert r18064 and correctly set the cell size for hash cells. svn path=/trunk/; revision=18070 --- reactos/ntoskrnl/cm/regfile.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/reactos/ntoskrnl/cm/regfile.c b/reactos/ntoskrnl/cm/regfile.c index 03d9db95f03..5b4abdada0c 100644 --- a/reactos/ntoskrnl/cm/regfile.c +++ b/reactos/ntoskrnl/cm/regfile.c @@ -3033,6 +3033,7 @@ CmiAllocateHashTableCell (IN PREGISTRY_HIVE RegistryHive, else { ASSERT(SubKeyCount <= 0xffff); /* should really be USHORT_MAX or similar */ + NewHashBlock->CellSize = -NewHashSize; NewHashBlock->Id = REG_HASH_TABLE_CELL_ID; NewHashBlock->HashTableSize = (USHORT)SubKeyCount; *HashBlock = NewHashBlock; @@ -3456,20 +3457,14 @@ CmiDestroyCell (PREGISTRY_HIVE RegistryHive, else { PCELL_HEADER pFree = Cell; - PHASH_TABLE_CELL pHash = Cell; - LONG CellSize; - if (pHash->Id == REG_HASH_TABLE_CELL_ID) - CellSize = sizeof(HASH_TABLE_CELL) + pHash->HashTableSize * sizeof(HASH_RECORD); - else - CellSize = abs(pFree->CellSize); + if (pFree->CellSize < 0) + pFree->CellSize = -pFree->CellSize; + + /* Clear block (except the block size) */ + RtlZeroMemory(((char*)pFree) + sizeof(ULONG), + pFree->CellSize - sizeof(ULONG)); - /* Clear block */ - RtlZeroMemory(pFree, CellSize); - - /* restore CellSize */ - pFree->CellSize = CellSize; - /* Add block to the list of free blocks */ CmiAddFree(RegistryHive, Cell, CellOffset, TRUE);