MiValidatePagefilePageHash
NTSTATUS __stdcall MiValidatePagefilePageHash(_MMINPAGE_SUPPORT *InPageSupport){
_MDL *p_Mdl;
__int64 v2;
_MDL *v3;
unsigned __int64 v4;
_MDL *v5;
char *MappedSystemVa;
unsigned __int64 v7;
_MDL *Next;
char *v9;
_MMPFN *PfnDb;
_MMPFN *v11;
unsigned __int64 v12;
unsigned int v13;
unsigned int v14;
_MMPAGING_FILE *v15;
void *v16;
unsigned int PagingFileOffset;
void *v18;
__int64 v20;
void *v21;
NTSTATUS v22;
PVOID BugCheckParameter4;
UINT64 Priority;
char *v25;
__int64 v26;
_MMPAGING_FILE *PagingFile;
_MDL *v28;
unsigned int v29;
UINT64 PageHashValues[8];
p_Mdl = &InPageSupport->Mdl;
if( InPageSupport->PrefetchMdl )
p_Mdl = InPageSupport->PrefetchMdl;
v2 = 0i64;
v29 = 0;
PagingFile = 0i64;
v3 = p_Mdl + 1;
v4 = 8
* ((((LODWORD(p_Mdl->StartVa) + p_Mdl->ByteOffset) & 0xFFF) + InPageSupport->IoStatus.Information + 4095) >> 12);
v5 = (_MDL *)((char *)p_Mdl + v4 + 48);
v26 = v4;
v28 = v5;
if( (p_Mdl->MdlFlags & 5) != 0 )
{
MappedSystemVa = (char *)p_Mdl->MappedSystemVa;
}
else
{
LODWORD(Priority) = -1073741808;
LODWORD(BugCheckParameter4) = 0;
MappedSystemVa = (char *)MmMapLockedPagesSpecifyCache(
p_Mdl,
0,
MmCached,
0i64,
(UINT64)BugCheckParameter4,
Priority);
}
if( v3 < v5 )
{
v7 = (unsigned __int64)v5;
while( 1 )
{
Next = v3->Next;
v9 = MappedSystemVa;
v25 = MappedSystemVa;
PfnDb = MmGetPfnDb();
v11 = &PfnDb[(__int64)v3->Next];
if( v11 != (_MMPFN *)*(&stru_140C4DB30 + 496) )
break;
LABEL_23:
v4 -= 8i64;
MappedSystemVa = v9 + 4096;
v2 = (unsigned int)(v2 + 1);
v26 = v4;
v3 = (_MDL *)((char *)v3 + 8);
if( !v9 )
MappedSystemVa = 0i64;
if( (unsigned __int64)v3 >= v7 )
return 0;
}
v12 = MiLockPageInline(&PfnDb[(_QWORD)Next]);
if( (v11->u2._bf_0 & 0x4000000000000000i64) != 0 )
{
LABEL_20:
if( (_BYTE)v12 != 17 )
{
_InterlockedAnd64(&v11->u2.Lock, 0x7FFFFFFFFFFFFFFFui64);
__writecr8(v12);
}
v7 = (unsigned __int64)v28;
goto LABEL_23;
}
v13 = (*((_DWORD *)&v11->3 + 4) >> 5) & 0x1F;
if( (dword_140CFA180 & 1) == 0
&& v13 != 31
&& (v13 >> 3 == 3 && ((*((_DWORD *)&v11->3 + 4) >> 5) & 7) != 0 || v13 >> 3 == 1) )
{
v9 = MappedSystemVa;
goto LABEL_20;
}
v14 = MiComputePageHash(v11, MappedSystemVa);
v15 = PagingFile;
v16 = (void *)v14;
if( !PagingFile )
{
v15 = *(_MMPAGING_FILE **)(*(_QWORD *)(*(&stru_140C4DB30 + 267)
+ 8 * (((unsigned __int64)v11->u4._bf_0 >> 39) & 0x3FF))
+ 8i64 * ((unsigned __int8)HIBYTE(*((_WORD *)&v11->3 + 8)) >> 4)
+ 6944);
PagingFile = v15;
}
PagingFileOffset = MiGetPagingFileOffset(&v11->OriginalPte);
v18 = (void *)PagingFileOffset;
if( !PagingFileOffset )
{
PagingFile = 0i64;
LABEL_19:
v4 = v26;
v9 = v25;
goto LABEL_20;
}
if( (unsigned int)v2 >= v29 )
{
v20 = v26 >> 3;
if( (unsigned int)(v26 >> 3) > 0x10 )
LODWORD(v20) = 16;
v29 = v20;
MiObtainPagefileHashes(v15, (unsigned int)v18, (unsigned int)v20, PageHashValues);
v2 = 0i64;
}
v21 = (void *)*((unsigned int *)PageHashValues + v2);
if( (_DWORD)v16 == (_DWORD)v21 || (v11->u2._bf_0 & 0x4000000000000000i64) != 0 || (_DWORD)v21 == 2 )
goto LABEL_19;
if( (_DWORD)v21 )
{
if( *(&stru_140C4DB30 + 2704) == 1 )
goto LABEL_19;
v22 = -1073741761;
}
else
{
v22 = MiComparePageHash(PagingFile, (unsigned int)v18, (unsigned int)v16);
}
if( v22 < 0 )
{
++*(&stru_140C4DB30 + 630);
*(&stru_140C4DB30 + 304) = Next;
KeBugCheckEx(0x1Au, (PVOID)0x3F, v18, v16, v21);
}
goto LABEL_19;
}
return 0;
}Referenced by:
MiMakeOutswappedPageResident
MiWaitForInPageComplete