CmCheckRegistry
__int64 __fastcall CmCheckRegistry(__int64 Hive, __int64 a2, _HIVE_LOAD_FAILURE *a3){
unsigned int v3;
unsigned int *v6;
_RTL_BITMAP *p_BitMapHeader;
char v8;
unsigned int v9;
unsigned int v10;
unsigned int *v11;
int v12;
int v13;
UINT64 v14;
INT64 v16;
UINT64 Point;
_RTL_BITMAP BitMapHeader;
_HIVE_LAYOUT_STATS_MOVE Stats;
__int128 v20;
__int128 v21;
__int64 v22;
CHAR v23;
INT64 v24;
int v25;
LODWORD(v24) = a2;
v3 = 0;
*(_QWORD *)&BitMapHeader.SizeOfBitMap = 0i64;
BitMapHeader.Buffer = 0i64;
v6 = 0i64;
v22 = 0i64;
p_BitMapHeader = 0i64;
Stats = 0i64;
v8 = 0;
v23 = 0;
v20 = 0i64;
v21 = 0i64;
if( Hive == *(_QWORD *)&CmpMasterHive )
return v3;
v9 = *(_DWORD *)(Hive + 272) >> 3;
v10 = (((v9 + 7) >> 3) + 7) & 0xFFFFFFF8;
if( (a2 & 0x80000) != 0 )
{
v11 = (unsigned int *)(*(__int64(__fastcall **)(_QWORD, _QWORD, __int64))(Hive + 24))(v10, 0i64, 1649167683i64);
v6 = v11;
if( !v11 )
{
LODWORD(Point) = 0;
v3 = -1073741670;
SetFailureLocation(a3, 0i64, _CmCheckRegistry, 3221225626i64, Point);
return v3;
}
BitMapHeader.SizeOfBitMap = v9;
BitMapHeader.Buffer = v11;
p_BitMapHeader = &BitMapHeader;
RtlClearAllBits(&BitMapHeader);
a2 = (unsigned int)v24;
}
v12 = a2 & 0x10000;
v25 = a2 & 0x10000;
while( 1 )
{
if( v12 )
{
if( p_BitMapHeader )
RtlClearAllBits(p_BitMapHeader);
v13 = HvCheckHive((_HHIVE *)Hive, a2, (__int64)a3, (__int64)p_BitMapHeader, &Stats, a3);
v3 = v13;
if( v13 < 0 )
{
LODWORD(Point) = 16;
goto LABEL_30;
}
if( Stats.MoveOutSpace + (int)v20 + (int)v21 > CmpReorganizeLimit )
*(_DWORD *)(Hive + 4152) |= 0x400u;
a2 = (unsigned int)v24;
*(_QWORD *)(Hive + 4792) = v22;
}
if( *(int *)(*(_QWORD *)(Hive + 64) + 36i64) < 0 )
break;
HIDWORD(Point) = HIDWORD(a3);
v13 = CmpValidateHiveSecurityDescriptors((CMHIVE *)Hive, a2, (UINT8 *)&v23, p_BitMapHeader);
v3 = v13;
if( v13 >= 0 )
goto LABEL_15;
if( v13 == -2147483606 )
{
v8 = 1;
LABEL_15:
v13 = CmpCheckRegistry2(
(_HHIVE *)Hive,
(unsigned int)v24,
*(unsigned int *)(*(_QWORD *)(Hive + 64) + 36i64),
v14,
v23,
p_BitMapHeader,
(UINT *)a3);
v3 = v13;
if( v13 >= 0 )
goto LABEL_16;
if( v13 == -2147483606 )
{
v8 = 1;
LABEL_16:
*(_DWORD *)(Hive + 4804) = 0;
v3 = v8 != 0 ? 0x8000002A : 0;
goto LABEL_17;
}
if( v13 != -1073741267 )
{
LODWORD(Point) = 64;
goto LABEL_30;
}
goto LABEL_25;
}
if( v13 != -1073741267 )
{
LODWORD(Point) = 48;
LABEL_30:
v16 = (unsigned int)v13;
goto LABEL_33;
}
LABEL_25:
v12 = v25;
v8 = 1;
a2 = (unsigned int)v24;
}
v3 = -1073741492;
LODWORD(Point) = 32;
v16 = 3221225804i64;
LABEL_33:
SetFailureLocation(a3, 0i64, _CmCheckRegistry, v16, Point);
LABEL_17:
if( v6 )
(*(void(__fastcall **)(unsigned int *, _QWORD))(Hive + 32))(v6, v10);
return v3;
}Referenced by:
CmpCreateHive
CmpReorganizeHive