MiGetPageForHeader
UINT64 __stdcall MiGetPageForHeader(_MI_PARTITION *Partition, UINT64 PreferredNode){
unsigned int v2;
_ETHREAD *CurrentThread;
char *SystemPage;
INT64 v6;
char v7;
char v8;
unsigned __int8 v9;
char v10;
_OWORD v12[2];
v2 = PreferredNode;
v12[0] = 0i64;
if( (unsigned int)MiObtainFaultCharges(Partition, 1ui64, 1ui64) )
{
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
MiInitializePageColorBase(*((_QWORD *)CurrentThread + 23) + 1664i64, v2, (INT64)v12);
SystemPage = MiGetSystemPage(Partition, (__int64)v12);
if( SystemPage )
{
MiGetEffectivePagePriorityThread(
CurrentThread,
(unsigned __int128)((SystemPage - (char *)MmGetPfnDb()) * (__int128)0x2AAAAAAAAAAAAAABi64) >> 64,
v6);
v8 = v7;
v9 = MiLockPageInline((INT64)SystemPage);
v10 = SystemPage[35] ^ v8;
*((_QWORD *)SystemPage + 1) = 0i64;
SystemPage[35] ^= v10 & 7;
*((_QWORD *)SystemPage + 3) |= 0x4000000000000000ui64;
*((_WORD *)SystemPage + 16) = 1;
*((_QWORD *)SystemPage + 2) = ZeroPte;
_InterlockedAnd64((volatile signed __int64 *)SystemPage + 3, 0x7FFFFFFFFFFFFFFFui64);
__writecr8(v9);
return(SystemPage - (char *)MmGetPfnDb()) / 48;
}
MiReturnFaultCharges(Partition, 1ui64, 1ui64);
}
return -1i64;
}Referenced by:
MiCreateMdl
MiInitializeImageProtos