Correctly interpret the cell type in CmiDestroyCell. Patch by brbak mpd000@yahoo.de. Modified: trunk/reactos/ntoskrnl/cm/regfile.c _____
Modified: trunk/reactos/ntoskrnl/cm/regfile.c --- trunk/reactos/ntoskrnl/cm/regfile.c 2005-09-25 17:59:20 UTC (rev 18063) +++ trunk/reactos/ntoskrnl/cm/regfile.c 2005-09-25 18:07:36 UTC (rev 18064) @@ -3456,14 +3456,20 @@
else { PCELL_HEADER pFree = Cell; + PHASH_TABLE_CELL pHash = Cell; + LONG CellSize;
- if (pFree->CellSize < 0) - pFree->CellSize = -pFree->CellSize; + if (pHash->Id == REG_HASH_TABLE_CELL_ID) + CellSize = sizeof(HASH_TABLE_CELL) + pHash->HashTableSize * sizeof(HASH_RECORD); + else + CellSize = abs(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);