[ros-diffs] [mjmartin] 44469: [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.

mjmartin at svn.reactos.org mjmartin at svn.reactos.org
Tue Dec 8 17:04:04 CET 2009


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?rev=44469&r1=44468&r2=44469&view=diff
==============================================================================
--- 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 */




More information about the Ros-diffs mailing list