From 4cff81907ac4f736faaec712e6732bc4ef3dd870 Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Sat, 12 Nov 2005 23:45:32 +0000 Subject: [PATCH] Fixed the growing of the dirty bitmap. This will fix the registry update bugs, if the binary hive is larger than 128kB. svn path=/trunk/; revision=19187 --- reactos/ntoskrnl/cm/regfile.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/reactos/ntoskrnl/cm/regfile.c b/reactos/ntoskrnl/cm/regfile.c index 7cb510c4336..1b1f4663c6a 100644 --- a/reactos/ntoskrnl/cm/regfile.c +++ b/reactos/ntoskrnl/cm/regfile.c @@ -862,7 +862,7 @@ CmiInitNonVolatileRegistryHive (PREGISTRY_HIVE RegistryHive, Filename); if (!NT_SUCCESS(Status)) { - DPRINT("RtlpCreateUnicodeString() failed (Status %lx)\n", Status); + DPRINT("RtlCreateUnicodeString() failed (Status %lx)\n", Status); return(Status); } @@ -3235,6 +3235,7 @@ CmiAddBin(PREGISTRY_HIVE RegistryHive, PHBIN tmpBin; ULONG BinSize; ULONG i; + ULONG BitmapSize; DPRINT ("CmiAddBin (BlockCount %lu)\n", BlockCount); @@ -3287,17 +3288,17 @@ CmiAddBin(PREGISTRY_HIVE RegistryHive, tmpBlock = (PCELL_HEADER)((ULONG_PTR) tmpBin + REG_HBIN_DATA_OFFSET); tmpBlock->CellSize = (BinSize - REG_HBIN_DATA_OFFSET); + /* Calculate bitmap size in bytes (always a multiple of 32 bits) */ + BitmapSize = ROUND_UP(RegistryHive->BlockListSize, sizeof(ULONG) * 8) / 8; + /* Grow bitmap if necessary */ - if (IsNoFileHive(RegistryHive) && - (RegistryHive->BlockListSize % (sizeof(ULONG) * 8) == 0)) + if (!IsNoFileHive(RegistryHive) && + BitmapSize > RegistryHive->DirtyBitMap.SizeOfBitMap) { PULONG BitmapBuffer; - ULONG BitmapSize; DPRINT("Grow hive bitmap\n"); - /* Calculate bitmap size in bytes (always a multiple of 32 bits) */ - BitmapSize = ROUND_UP(RegistryHive->BlockListSize, sizeof(ULONG) * 8) / 8; DPRINT("RegistryHive->BlockListSize: %lu\n", RegistryHive->BlockListSize); DPRINT("BitmapSize: %lu Bytes %lu Bits\n", BitmapSize, BitmapSize * 8); BitmapBuffer = (PULONG)ExAllocatePool(PagedPool,