CmpFindSubKeyInRoot
NTSTATUS __stdcall CmpFindSubKeyInRoot(PVOID OwnerHandle, PVOID ParentIoAttributionContext){
_UNICODE_STRING *v2;
UINT64 v3;
UINT64 v4;
unsigned int *v5;
unsigned int v6;
unsigned int v7;
__int64 v9;
unsigned int v10;
__int64 Child;
UINT *v12;
int v13;
int v14;
void(__fastcall *v15)(PVOID, int *);
__int64 v16;
_UNICODE_STRING *v17;
int v18;
int v19;
__int64 v21;
int v22;
int v23;
int v24;
PVOID v25;
_UNICODE_STRING *SearchName;
unsigned int *v27;
SearchName = v2;
v25 = ParentIoAttributionContext;
v23 = -1;
v4 = v3;
v5 = v27;
v6 = *((unsigned __int16 *)ParentIoAttributionContext + 1) - 1;
v7 = 0;
v24 = 0;
while( 1 )
{
v9 = v7 + ((v6 - v7) >> 1);
v10 = *((_DWORD *)ParentIoAttributionContext + v9 + 1);
Child = (*((__int64(__fastcall **)(PVOID, _QWORD, int *))OwnerHandle + 1))(OwnerHandle, v10, &v23);
v12 = (UINT *)Child;
if( !Child )
goto LABEL_27;
v13 = CmpCompareInIndex(
(_HHIVE *)OwnerHandle,
SearchName,
v4,
(_CM_KEY_INDEX *)((unsigned int)*(unsigned __int16 *)(Child + 2) - 1),
(UINT *)Child);
if( v13 == 2 )
goto LABEL_27;
if( !v13 )
goto LABEL_17;
if( v13 >= 0 )
{
v7 += (v6 - v7) >> 1;
}
else
{
v14 = CmpCompareInIndex((_HHIVE *)OwnerHandle, SearchName, v4, 0i64, v12);
if( v14 == 2 )
goto LABEL_27;
if( v14 >= 0 )
goto LABEL_17;
v6 = v7 + ((v6 - v7) >> 1);
}
v15 = (void(__fastcall *)(PVOID, int *))*((_QWORD *)OwnerHandle + 2);
if( v6 - v7 <= 1 )
break;
v15(OwnerHandle, &v23);
ParentIoAttributionContext = v25;
}
v15(OwnerHandle, &v23);
v10 = *((_DWORD *)v25 + v7 + 1);
v16 = (*((__int64(__fastcall **)(PVOID, _QWORD, int *))OwnerHandle + 1))(OwnerHandle, v10, &v23);
v12 = (UINT *)v16;
if( !v16 )
goto LABEL_27;
v17 = SearchName;
v18 = CmpCompareInIndex(
(_HHIVE *)OwnerHandle,
SearchName,
v4,
(_CM_KEY_INDEX *)((unsigned int)*(unsigned __int16 *)(v16 + 2) - 1),
(UINT *)v16);
if( v18 == 2 )
goto LABEL_27;
if( !v18 )
{
LODWORD(v9) = v7;
goto LABEL_17;
}
if( v18 < 0 )
{
v19 = CmpCompareInIndex((_HHIVE *)OwnerHandle, v17, v4, 0i64, v12);
if( v19 != 2 )
{
LODWORD(v9) = v7;
if( v19 >= 0 )
goto LABEL_17;
goto LABEL_25;
}
goto LABEL_27;
}
(*((void(__fastcall **)(PVOID, int *))OwnerHandle + 2))(OwnerHandle, &v23);
v10 = *((_DWORD *)v25 + v6 + 1);
v21 = (*((__int64(__fastcall **)(PVOID, _QWORD, int *))OwnerHandle + 1))(OwnerHandle, v10, &v23);
v12 = (UINT *)v21;
if( !v21
|| (v22 = CmpCompareInIndex(
(_HHIVE *)OwnerHandle,
v17,
v4,
(_CM_KEY_INDEX *)((unsigned int)*(unsigned __int16 *)(v21 + 2) - 1),
(UINT *)v21),
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( v12 )
(*((void(__fastcall **)(PVOID, int *))OwnerHandle + 2))(OwnerHandle, &v23);
return v9;
}Referenced by:
CmpFindSubKeyByNameWithStatus
CmpMarkIndexDirty
CmpRemoveSubKeyFromList
CmpSelectLeaf
CmpWalkOneLevel