MiCfgMarkValidEntries
__int64 __fastcall MiCfgMarkValidEntries(
_EPROCESS *CurrentProcess,
VOID *EndVa,
unsigned __int64 a3,
_QWORD *a4,
int a5,
__int64 a6,
char a7,
_SECTION *Section,
__int64 a9){
unsigned int v12;
unsigned int v13;
_MI_CFG_BITMAP_INFO *v14;
_MI_CFG_BITMAP_INFO *v15;
unsigned int v16;
unsigned int v17;
_QWORD *v18;
__int64 v19;
int v20;
__int64 v21;
int v22;
__int64 v23;
_MI_RVA_LIST_TYPE v24;
__int64 v25;
char *v26;
NTSTATUS v27;
_QWORD *v29;
bool v30;
unsigned int SessionId;
__int64 v32;
__int128 RvaList;
__int64 v34;
INT64 v36;
v34 = 0i64;
LODWORD(v36) = 0;
RvaList = 0i64;
*(_DWORD *)a6 = 0;
if( (((unsigned __int16)EndVa | (unsigned __int16)a3) & 0xFFF) != 0 )
return 3221225485i64;
v12 = a5;
v13 = 1;
if( (unsigned int)a5 > 1 )
{
v29 = a4 + 2;
while( a4[2 * v13 - 2] <= *v29 )
{
++v13;
v29 += 2;
if( v13 >= a5 )
goto LABEL_3;
}
return 3221225485i64;
}
LABEL_3:
if( a4[2 * (unsigned int)(a5 - 1)] >= a3 )
return 3221225485i64;
LODWORD(v14) = MiSelectCfgBitMap(CurrentProcess, EndVa, 0i64);
v15 = v14;
v17 = v16;
if( v12 )
{
v18 = a4;
while( (*v18 & 0xFi64) == v15[6] )
{
v19 = v18[1];
if( (v19 & 0xFFFFFFFFFFFFFFF8ui64) != 0 )
break;
if( (a7 & 1) != 0 && (v19 & 1) != 0 )
return 3221225506i64;
if( (v19 & 4) != 0 )
{
LOBYTE(v20) = MiIsProcessCfgExportSuppressionEnabled();
if( !v20 )
return 3221225506i64;
if( CfgAddressToBitState((UINT64)EndVa + v21, *(const INT64 **)v15) != 2
|| (LOBYTE(v22) = MiIsProcessCfgExportSuppressionEnabled(), !v22) )
{
if( !MiValidateUserCallTarget((char *)EndVa + *v18, v15) )
return 3221225506i64;
}
}
++v17;
v18 += 2;
if( v17 >= v12 )
goto LABEL_14;
}
return 3221225485i64;
}
LABEL_14:
if( *(_DWORD *)a6 == v12 )
return 0i64;
if( !MiIsProcessCfgEnabled() )
return 3221225541i64;
LODWORD(v23) = MiObtainReferencedVadEx((UINT64)EndVa, 0, &v36);
v25 = v23;
if( !v23 )
return(unsigned int)v36;
v26 = (char *)EndVa + a3 - 1;
if( (unsigned __int64)v26 <= (((*(unsigned int *)(v23 + 28) | ((unsigned __int64)*(unsigned __int8 *)(v23 + 33) << 32)) << 12) | 0xFFF)
&& (!Section
|| (v30 = (*(_DWORD *)(v23 + 48) & 0x100000) == 0, v36 = 0i64, v30)
&& **(_CONTROL_AREA ***)(v23 + 72) == MiSectionControlArea(Section)
&& (VOID *)((*(unsigned int *)(v25 + 24) | ((unsigned __int64)*(unsigned __int8 *)(v25 + 32) << 32)) << 12) == EndVa
&& (MiGetProtoPteAddress(),
SessionId = MmGetSessionIdEx(CurrentProcess),
LODWORD(v32) = MiStartingOffset((_SUBSECTION *)v36, *(_MMPTE **)(v25 + 80), SessionId),
v32 == a9)) )
{
v34 = a6;
LODWORD(RvaList) = v12;
*((_QWORD *)&RvaList + 1) = a4;
v27 = MiPopulateCfgBitMap(
v15,
&RvaList,
v24,
(VOID *)1,
EndVa,
(_MI_CFG_COPY_TO_BITMAP_OPTION)(((_DWORD)v26 + 4095) & 0xFFFFF000));
if( v27 >= 0 )
v27 = 0;
}
else
{
v27 = -1073741811;
}
MiUnlockAndDereferenceVad((_MMVAD_SHORT *)v25);
return(unsigned int)v27;
}Referenced by:
NtSetInformationVirtualMemory