- Fix usage of RtlFindSetBits and loops in CmiStartLogUpdate and CmiStartHiveUpdate.

svn path=/trunk/; revision=11054
This commit is contained in:
Filip Navara 2004-09-25 20:53:29 +00:00
parent 3823d945f5
commit 630b1b2eb3

View file

@ -1397,6 +1397,7 @@ CmiStartLogUpdate(PREGISTRY_HIVE RegistryHive)
PUCHAR Buffer; PUCHAR Buffer;
PUCHAR Ptr; PUCHAR Ptr;
ULONG BlockIndex; ULONG BlockIndex;
ULONG LastIndex;
PVOID BlockPtr; PVOID BlockPtr;
NTSTATUS Status; NTSTATUS Status;
@ -1486,13 +1487,13 @@ CmiStartLogUpdate(PREGISTRY_HIVE RegistryHive)
/* Write dirty blocks */ /* Write dirty blocks */
FileOffset.QuadPart = (ULONGLONG)BufferSize; FileOffset.QuadPart = (ULONGLONG)BufferSize;
BlockIndex = 0; BlockIndex = 0;
while (TRUE) while (BlockIndex < RegistryHive->BlockListSize)
{ {
LastIndex = BlockIndex;
BlockIndex = RtlFindSetBits(&RegistryHive->DirtyBitMap, BlockIndex = RtlFindSetBits(&RegistryHive->DirtyBitMap,
1, 1,
BlockIndex); BlockIndex);
if ((BlockIndex == (ULONG)-1) || if (BlockIndex == (ULONG)-1 || BlockIndex < LastIndex)
(BlockIndex >= RegistryHive->BlockListSize))
{ {
DPRINT("No more set bits\n"); DPRINT("No more set bits\n");
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
@ -1771,6 +1772,7 @@ CmiStartHiveUpdate(PREGISTRY_HIVE RegistryHive)
HANDLE FileHandle; HANDLE FileHandle;
LARGE_INTEGER FileOffset; LARGE_INTEGER FileOffset;
ULONG BlockIndex; ULONG BlockIndex;
ULONG LastIndex;
PVOID BlockPtr; PVOID BlockPtr;
NTSTATUS Status; NTSTATUS Status;
@ -1823,13 +1825,13 @@ CmiStartHiveUpdate(PREGISTRY_HIVE RegistryHive)
} }
BlockIndex = 0; BlockIndex = 0;
while (TRUE) while (BlockIndex < RegistryHive->BlockListSize)
{ {
LastIndex = BlockIndex;
BlockIndex = RtlFindSetBits(&RegistryHive->DirtyBitMap, BlockIndex = RtlFindSetBits(&RegistryHive->DirtyBitMap,
1, 1,
BlockIndex); BlockIndex);
if ((BlockIndex == (ULONG)-1) || if (BlockIndex == (ULONG)-1 || BlockIndex < LastIndex)
(BlockIndex >= RegistryHive->BlockListSize))
{ {
DPRINT("No more set bits\n"); DPRINT("No more set bits\n");
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;