MiMapMemoryDumpMdl
CHAR __fastcall MiMapMemoryDumpMdl(UINT64 rcx0, INT64 a2, INT64 a3, CHAR a4){
__int64 v6;
__int64 v7;
UINT64 v8;
_QWORD *v9;
INT64 v10;
UINT64 *v11;
__int64 v12;
unsigned int v13;
unsigned __int64 CurrentThread;
__int64 v15;
UINT64 v16;
INT64 v17;
int ProtectionPfnCompatible;
UINT64 ValidPte;
int v20;
bool v21;
char *a1;
INT64 result;
int v27;
int v28;
__int64 v29;
memset((INT64)&result, 0i64);
v6 = *(unsigned int *)(a3 + 44);
v7 = ((unsigned int)(v6 + *(_DWORD *)(a3 + 40)) >> 12) + ((((_DWORD)v6 + *(_DWORD *)(a3 + 40)) & 0xFFF) != 0);
v27 = 20;
a1 = (char *)MmGetPteBase() + ((rcx0 >> 9) & 0x7FFFFFFFF8i64);
*(_QWORD *)(a3 + 24) = rcx0 + v6;
v8 = rcx0 & 0xFFFFFFFFFFFFF000ui64;
BYTE4(result) = 3;
v29 = 0i64;
v9 = a1;
do
{
v10 = MI_READ_PTE_LOCK_FREE((INT64)v9);
if( (v10 & 1) != 0 )
MiInsertTbFlushEntry((INT64)&result, v8, 1i64, 0i64);
if( v10 )
*v9 = 0i64;
++v9;
v8 += 4096i64;
--v7;
}
while( v7 );
v11 = (UINT64 *)a1;
if( v28 )
MiFlushTbList((__int64)&result);
v12 = *(unsigned int *)(a3 + 44);
v13 = v12 + *(_DWORD *)(a3 + 40);
CurrentThread = (v13 & 0xFFF) != 0;
*(_QWORD *)(a3 + 24) = rcx0 + v12;
v15 = (v13 >> 12) + (unsigned int)CurrentThread;
if( (a4 & 2) != 0 )
{
*(_WORD *)(a3 + 10) &= 0xFFDEu;
return CurrentThread;
}
v16 = a3 - ((rcx0 >> 9) & 0x7FFFFFFFF8i64) - (_QWORD)MmGetPteBase();
do
{
v17 = *(UINT64 *)((char *)v11 + v16 + 48);
ProtectionPfnCompatible = 4;
if( (a4 & 1) == 0 )
ProtectionPfnCompatible = MiMakeProtectionPfnCompatible(4ui64, (_MMPFN *)((char *)MmGetPfnDb() + 48 * v17));
ValidPte = MiMakeValidPte((UINT64)v11, v17, ProtectionPfnCompatible | 0xA0000000);
v20 = 0;
LODWORD(CurrentThread) = MiPteInShadowRange((UINT64)v11);
if( (_DWORD)CurrentThread )
{
LODWORD(CurrentThread) = MiPteHasShadow();
if( (_DWORD)CurrentThread )
{
v20 = 1;
if( HIBYTE(word_140C4DD48) )
goto LABEL_14;
v21 = (ValidPte & 1) == 0;
}
else
{
CurrentThread = (unsigned __int64)KeGetCurrentThread();
if( (*(_DWORD *)(*(_QWORD *)(CurrentThread + 184) + 2172i64) & 0x1000) == 0 )
goto LABEL_14;
v21 = (ValidPte & 1) == 0;
}
if( !v21 )
ValidPte |= 0x8000000000000000ui64;
}
LABEL_14:
*v11 = ValidPte;
if( v20 )
LOBYTE(CurrentThread) = MiWritePteShadow();
++v11;
--v15;
}
while( v15 );
*(_WORD *)(a3 + 10) |= 0x11u;
return CurrentThread;
}Referenced by:
MmMapMemoryDumpMdl
MmMapMemoryDumpMdlEx
MmMapMemoryDumpMdlEx2