CmpFindSubKeyInRoot
INT64 __fastcall CmpFindSubKeyInRoot(
_HHIVE *Hive,
_CM_KEY_INDEX *Index,
const _UNICODE_STRING *SearchName,
UINT *Child){
unsigned int *v5;
unsigned int v6;
int v7;
__int64 v9;
unsigned int v10;
_CELL_DATA *v11;
UINT *KeyList;
int v13;
int v14;
void(__fastcall *ReleaseCellRoutine)(_HHIVE *, _HV_GET_CELL_CONTEXT *);
_CELL_DATA *v16;
_UNICODE_STRING *v17;
int v18;
int v19;
_CELL_DATA *v21;
int v22;
int v23;
int v24;
_CM_KEY_INDEX *v25;
_UNICODE_STRING *SearchNamea;
unsigned int *v27;
SearchNamea = (_UNICODE_STRING *)SearchName;
v25 = Index;
v23 = -1;
v5 = v27;
v6 = Index->Count - 1;
v7 = 0;
v24 = 0;
while( 1 )
{
v9 = v7 + ((v6 - v7) >> 1);
v10 = Index->List[v9];
v11 = Hive->GetCellRoutine(Hive, v10, &v23);
KeyList = v11->u.KeyList;
if( !v11 )
goto LABEL_27;
v13 = CmpCompareInIndex(
Hive,
SearchNamea,
(UINT64)Child,
(_CM_KEY_INDEX *)((unsigned int)v11->u.KeyNode.Flags - 1),
v11->u.KeyList);
if( v13 == 2 )
goto LABEL_27;
if( !v13 )
goto LABEL_17;
if( v13 >= 0 )
{
v7 += (v6 - v7) >> 1;
}
else
{
v14 = CmpCompareInIndex(Hive, SearchNamea, (UINT64)Child, 0i64, KeyList);
if( v14 == 2 )
goto LABEL_27;
if( v14 >= 0 )
goto LABEL_17;
v6 = v7 + ((v6 - v7) >> 1);
}
ReleaseCellRoutine = Hive->ReleaseCellRoutine;
if( v6 - v7 <= 1 )
break;
ReleaseCellRoutine(Hive, (_HV_GET_CELL_CONTEXT *)&v23);
Index = v25;
}
ReleaseCellRoutine(Hive, (_HV_GET_CELL_CONTEXT *)&v23);
v10 = v25->List[v7];
v16 = Hive->GetCellRoutine(Hive, v10, &v23);
KeyList = v16->u.KeyList;
if( !v16 )
goto LABEL_27;
v17 = SearchNamea;
v18 = CmpCompareInIndex(
Hive,
SearchNamea,
(UINT64)Child,
(_CM_KEY_INDEX *)((unsigned int)v16->u.KeyNode.Flags - 1),
v16->u.KeyList);
if( v18 == 2 )
goto LABEL_27;
if( !v18 )
{
LODWORD(v9) = v7;
goto LABEL_17;
}
if( v18 < 0 )
{
v19 = CmpCompareInIndex(Hive, v17, (UINT64)Child, 0i64, KeyList);
if( v19 != 2 )
{
LODWORD(v9) = v7;
if( v19 >= 0 )
goto LABEL_17;
goto LABEL_25;
}
goto LABEL_27;
}
Hive->ReleaseCellRoutine(Hive, (_HV_GET_CELL_CONTEXT *)&v23);
v10 = v25->List[v6];
v21 = Hive->GetCellRoutine(Hive, v10, &v23);
KeyList = v21->u.KeyList;
if( !v21
|| (v22 = CmpCompareInIndex(
Hive,
v17,
(UINT64)Child,
(_CM_KEY_INDEX *)((unsigned int)v21->u.KeyNode.Flags - 1),
v21->u.KeyList),
v22 == 2) )
{
LABEL_27:
LODWORD(v9) = 0x80000000;
LABEL_25:
v10 = -1;
goto LABEL_17;
}
LODWORD(v9) = v6;
if( v22 && v22 >= 0 )
goto LABEL_25;
LABEL_17:
*v5 = v10;
if( KeyList )
Hive->ReleaseCellRoutine(Hive, (_HV_GET_CELL_CONTEXT *)&v23);
return(unsigned int)v9;
}Referenced by:
CmpFindSubKeyByNameWithStatus
CmpMarkIndexDirty
CmpRemoveSubKeyFromList
CmpSelectLeaf
CmpWalkOneLevel