[ros-diffs] [mjmartin] 44303: [ntoskrnl/config] - CmpFindSubKeyInName: CmpFindSubKeyInRoot is useless in finding the correct leaf with the key name that is being searched for when keys are not sorted. Loop and search each leaf of the root index for the key name. See bug #4895 for more info.

mjmartin at svn.reactos.org mjmartin at svn.reactos.org
Sat Nov 28 15:54:34 CET 2009


Author: mjmartin
Date: Sat Nov 28 15:54:34 2009
New Revision: 44303

URL: http://svn.reactos.org/svn/reactos?rev=44303&view=rev
Log:
[ntoskrnl/config]
- CmpFindSubKeyInName: CmpFindSubKeyInRoot is useless in finding the correct leaf with the key name that is being searched for when keys are not sorted. Loop and search each leaf of the root index for the key name. See bug #4895 for more info.

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=44303&r1=44302&r2=44303&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmindex.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmindex.c [iso-8859-1] Sat Nov 28 15:54:34 2009
@@ -733,6 +733,33 @@
             /* Check if this is another index root */
             if (IndexRoot->Signature == CM_KEY_INDEX_ROOT)
             {
+
+#ifndef SOMEONE_WAS_NICE_ENOUGH_TO_MAKE_OUR_CELLS_LEXICALLY_SORTED
+                /* CmpFindSubKeyInRoot is useless for actually finding the correct leaf when keys are not sorted */
+                LONG ii;
+                PCM_KEY_INDEX Leaf;
+                /* Loop through each leaf in the index root */
+                for (ii=0; ii<IndexRoot->Count; ii++)
+                {
+                    Leaf = HvGetCell(Hive, IndexRoot->List[ii]);
+                    if (Leaf)
+                    {
+                        Found = CmpFindSubKeyInLeaf(Hive, Leaf, SearchName, &SubKey);
+                        HvReleaseCell(Hive, IndexRoot->List[ii]);
+                        if (Found & 0x80000000)
+                        {
+                            HvReleaseCell(Hive, CellToRelease);
+                            return HCELL_NIL;
+                        }
+
+                        if ((Found) && (SubKey != HCELL_NIL))
+                        {
+                            HvReleaseCell(Hive, CellToRelease);
+                            return SubKey;
+                        }
+                    }
+                 }
+#endif
                 /* Lookup the name in the root */
                 Found = CmpFindSubKeyInRoot(Hive,
                                             IndexRoot,




More information about the Ros-diffs mailing list