Author: mjmartin
Date: Tue Dec 8 17:04:03 2009
New Revision: 44469
URL: http://svn.reactos.org/svn/reactos?rev=44469&view=rev
Log:
[ntoskrnl\config]
- CmpSplitLeaf: When the leaf to insert is not the last leaf: Don't copy the leaf data from the location where the new leaf will be inserted to the next leaf.
There may be more leafs following (registry corruption), the leafs may be different sizes (memory corruption) and a simpler solution exists.
- Just shift all the indexes of the root to the right of the insertion point.
- Fixes bug check when leafs are split more than once.
Modified:
trunk/reactos/ntoskrnl/config/cmindex.c
Modified: trunk/reactos/ntoskrnl/config/cmindex.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmindex.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmindex.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmindex.c [iso-8859-1] Tue Dec 8 17:04:03 2009
@@ -1289,13 +1289,14 @@
LastHalf * EntrySize);
}
- /* Shift the data inside the root key */
+ /* If RootSelect is not the last index */
if (RootSelect < (IndexKey->Count - 1))
{
- RtlMoveMemory(&IndexKey->List[RootSelect + 2],
- &IndexKey->List[RootSelect + 1],
- IndexKey->Count -
- (RootSelect + 1) * sizeof(HCELL_INDEX));
+ /* Shift indexes to the right */
+ ULONG IndexCount;
+ /* IndexKey->Count will be incremented below */
+ for (IndexCount = IndexKey->Count; IndexCount > RootSelect + 1; IndexCount --)
+ IndexKey->List[IndexCount] = IndexKey->List[IndexCount -1];
}
/* Make sure both old and new computed counts are valid */
Author: tkreuzer
Date: Tue Dec 8 03:18:42 2009
New Revision: 44465
URL: http://svn.reactos.org/svn/reactos?rev=44465&view=rev
Log:
Cleanup test code, improve comments.
Modified:
trunk/reactos/lib/rtl/bitmap.c
Modified: trunk/reactos/lib/rtl/bitmap.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap.c?rev=44465…
==============================================================================
--- trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] Tue Dec 8 03:18:42 2009
@@ -83,11 +83,12 @@
/* Calculate length up to where we read */
Length = (Buffer - BitMapHeader->Buffer) * 32 - StartingIndex;
Length += BitPos - 32;
-
+
+ /* Make sure we don't go past the last bit */
if (Length > BitMapHeader->SizeOfBitMap - StartingIndex)
Length = BitMapHeader->SizeOfBitMap - StartingIndex;
- /* The result is guaranteed to be < BitMapHeader->SizeOfBitMap */
+ /* Return the result */
return Length;
}
@@ -132,10 +133,11 @@
Length = (Buffer - BitMapHeader->Buffer) * 32 - StartingIndex;
Length += BitPos - 32;
+ /* Make sure we don't go past the last bit */
if (Length > BitMapHeader->SizeOfBitMap - StartingIndex)
Length = BitMapHeader->SizeOfBitMap - StartingIndex;
- /* The result is guaranteed to be < BitMapHeader->SizeOfBitMap */
+ /* Return the result */
return Length;
}
@@ -436,12 +438,10 @@
/* Loop until something is found or the end is reached */
while (CurrentBit + NumberToFind < BitMapHeader->SizeOfBitMap)
{
- ULONG test;
/* Search for the next clear run, by skipping a set run */
- test = RtlpGetLengthOfRunSet(BitMapHeader,
+ CurrentBit += RtlpGetLengthOfRunSet(BitMapHeader,
CurrentBit,
MAXULONG);
- CurrentBit += test;
/* Get length of the clear bit run */
CurrentLength = RtlpGetLengthOfRunClear(BitMapHeader,