CmpCheckRegistry2
INT64 __fastcall CmpCheckRegistry2(
_HHIVE *HiveToCheck,
UINT64 CheckFlags,
UINT64 Cell,
UINT64 ParentCell,
UINT8 ResetSD,
_RTL_BITMAP *Bitmap,
UINT *KeyCount){
int v7;
unsigned int v8;
unsigned int v10;
void *(__fastcall *Allocate)(unsigned int, unsigned __int8, unsigned int);
__int64 v12;
INT64 *v14;
unsigned int *v15;
__int64 v16;
unsigned int *v17;
int v18;
int v19;
unsigned int v20;
UINT64 v21;
int v22;
_CELL_DATA *v23;
unsigned int v24;
__int64 v25;
_CELL_DATA *(__fastcall *GetCellRoutine)(_HHIVE *, unsigned int, _HV_GET_CELL_CONTEXT *);
INT16 *v27;
unsigned int SubKeyByNumber;
__int64 v29;
int v30;
int v31;
INT64 v32;
void *v33;
int v34;
UINT64 Point;
unsigned int *v36;
__int64 v37;
int v38[4];
int v39;
char v40;
INT64 *v41;
v40 = 0;
v7 = Cell;
v8 = CheckFlags;
v10 = 0;
v37 = 0i64;
Allocate = HiveToCheck->Allocate;
LODWORD(v37) = -1;
v12 = (__int64)Allocate(10240u, 0, 1935887683u);
v36 = (unsigned int *)v12;
if( !v12 )
{
LODWORD(Point) = 0;
SetFailureLocation((_HIVE_LOAD_FAILURE *)KeyCount, 0i64, _CmCheckRegistry2, 3221225626i64, Point);
return 3221225626i64;
}
if( KeyCount )
*((_QWORD *)KeyCount + 29) = v12;
v14 = v41;
v15 = (unsigned int *)(v12 - 20);
*(_DWORD *)v12 = v7;
v16 = 0i64;
*(_QWORD *)(v12 + 4) = -1i64;
v17 = (unsigned int *)v12;
*(_DWORD *)(v12 + 12) = 0;
*(_DWORD *)v41 = 0;
*(_BYTE *)(v12 + 16) = 0;
v39 = 0;
while( 1 )
{
if( *((_BYTE *)v17 + 16) )
goto LABEL_17;
v18 = *(_DWORD *)v14;
*((_BYTE *)v17 + 16) = 1;
if( v18 != -1 )
*(_DWORD *)v14 = v18 + 1;
v19 = CmpCheckKey(HiveToCheck, v8, *v17, v17[1], ResetSD, Bitmap);
v20 = v19;
if( v19 != -2147483606 )
break;
v40 = 1;
LABEL_12:
if( (v8 & 0x100000) != 0 && v16 > 0 )
{
v21 = v15[2];
if( (_DWORD)v21 != -1 )
{
v22 = CmpCheckLexicographicalOrder(HiveToCheck, v21, *v17);
v20 = v22;
if( v22 < 0 )
{
if( v22 == -1073741492 )
{
v30 = 48;
v31 = v8 & 0x20000;
goto LABEL_35;
}
LODWORD(Point) = 37;
v32 = (unsigned int)v22;
LABEL_54:
SetFailureLocation((_HIVE_LOAD_FAILURE *)KeyCount, 0i64, _CmCheckRegistry2, v32, Point);
LABEL_55:
v33 = v36;
goto LABEL_56;
}
}
v15[2] = *v17;
}
LABEL_17:
v23 = HiveToCheck->GetCellRoutine(HiveToCheck, *v17, &v37);
if( !v23 )
{
LODWORD(Point) = 64;
goto LABEL_53;
}
v24 = v17[3];
if( v24 >= v23->u.KeyNode.SubKeyCounts[0] )
{
v15 -= 5;
v29 = -1i64;
v17 -= 5;
}
else
{
v25 = v23->u.KeyNode.SubKeyLists[0];
GetCellRoutine = HiveToCheck->GetCellRoutine;
v38[1] = 0;
v38[0] = -1;
v27 = (INT16 *)GetCellRoutine(HiveToCheck, v25, (_HV_GET_CELL_CONTEXT *)v38);
if( !v27 )
{
v34 = 80;
goto LABEL_46;
}
SubKeyByNumber = CmpDoFindSubKeyByNumber((INT64)HiveToCheck, v27, v24);
HiveToCheck->ReleaseCellRoutine(HiveToCheck, (_HV_GET_CELL_CONTEXT *)v38);
if( SubKeyByNumber == -1 )
{
v34 = 88;
LABEL_46:
v20 = -1073741670;
goto LABEL_47;
}
++v17[3];
v15 += 5;
v17 += 5;
if( v16 == 511 )
{
v20 = -1073741492;
v34 = 96;
LABEL_47:
LODWORD(Point) = v34;
SetFailureLocation((_HIVE_LOAD_FAILURE *)KeyCount, 0i64, _CmCheckRegistry2, v20, Point);
HiveToCheck->ReleaseCellRoutine(HiveToCheck, (_HV_GET_CELL_CONTEXT *)&v37);
goto LABEL_55;
}
v17[1] = *v15;
v29 = 1i64;
*v17 = SubKeyByNumber;
v17[2] = -1;
v17[3] = 0;
*((_BYTE *)v17 + 16) = 0;
}
v39 += v29;
v16 += v29;
HiveToCheck->ReleaseCellRoutine(HiveToCheck, (_HV_GET_CELL_CONTEXT *)&v37);
if( v16 < 0 )
{
if( (v8 & 0x20000) != 0 || CmpCheckAndFixSecurityCellsRefcount((CMHIVE *)HiveToCheck) )
{
v20 = v40 != 0 ? 0x8000002A : 0;
goto LABEL_55;
}
LODWORD(Point) = 112;
LABEL_53:
v20 = -1073741492;
v32 = 3221225804i64;
goto LABEL_54;
}
v14 = v41;
}
if( v19 >= 0 )
goto LABEL_12;
if( v19 != -1073741492 )
goto LABEL_55;
v31 = v8 & 0x20000;
if( !v31 )
{
if( BYTE3(NlsMbCodePageTag) )
v10 = 1;
else
LOBYTE(v10) = (*(&CmpDummyThreadEvent + 2744) & 6) != 0;
}
v30 = 16;
LABEL_35:
LODWORD(Point) = v30;
SetFailureLocation((_HIVE_LOAD_FAILURE *)KeyCount, v10, _CmCheckRegistry2, v20, Point);
if( v31 || !BYTE3(NlsMbCodePageTag) && (*(&CmpDummyThreadEvent + 2744) & 6) == 0 || !v39 )
{
LODWORD(Point) = 24;
goto LABEL_53;
}
v33 = v36;
if( CmpRemoveSubKeyCellNoCellRef((__int64)HiveToCheck, (PVOID)v36[5 * v39 + 1], v36[5 * v39]) )
{
v20 = -1073741267;
HiveToCheck->BaseBlock->BootType |= 4u;
}
else
{
LODWORD(Point) = 32;
v20 = -1073741492;
SetFailureLocation((_HIVE_LOAD_FAILURE *)KeyCount, 0i64, _CmCheckRegistry2, 3221225804i64, Point);
}
LABEL_56:
HiveToCheck->Free(v33, 10240u);
return v20;
}Referenced by:
CmCheckRegistry