diff --git a/reactos/ntoskrnl/config/cmindex.c b/reactos/ntoskrnl/config/cmindex.c index 162263d7590..0948bd31dd4 100644 --- a/reactos/ntoskrnl/config/cmindex.c +++ b/reactos/ntoskrnl/config/cmindex.c @@ -733,6 +733,33 @@ CmpFindSubKeyByName(IN PHHIVE Hive, /* 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; iiCount; 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,