MiGetFileHashPage
NTSTATUS __stdcall MiGetFileHashPage(_MMPAGING_FILE *PagingFile, UINT64 Color){
_MI_PARTITION *Partition;
unsigned __int64 v3;
unsigned int v4;
int v5;
UINT64 v6;
NTSTATUS v7;
_DWORD *v8;
void *v9;
unsigned __int64 v10;
struct _KPRCB *CurrentPrcb;
__int64 CachedResidentAvailable;
bool v14;
signed __int32 v15;
UINT8 OldIrql;
Partition = PagingFile->Partition;
v3 = 1i64;
v4 = Color;
OldIrql = 0;
MiAcquireNonPagedResources(Partition, 1ui64);
if( v5 >= 0 )
{
LODWORD(v6) = MiGetPage((ULONG_PTR *)&Partition->Core.PartitionId, v4, 0x200ui64);
v7 = v6;
if( v6 == -1i64 )
{
MiReturnCommit(Partition, 1ui64);
if( Partition != &Irp )
goto LABEL_21;
CurrentPrcb = KeGetCurrentPrcb();
CachedResidentAvailable = (int)CurrentPrcb->CachedResidentAvailable;
if( (_DWORD)CachedResidentAvailable == -1 )
goto LABEL_21;
if( (unsigned __int64)(CachedResidentAvailable + 1) <= 0x100 )
{
do
{
v15 = _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
CachedResidentAvailable + 1,
CachedResidentAvailable);
v14 = (_DWORD)CachedResidentAvailable == v15;
LODWORD(CachedResidentAvailable) = v15;
if( v14 )
return v7;
}
while( v15 != -1 && (unsigned __int64)(v15 + 1i64) <= 0x100 );
}
if( (int)CachedResidentAvailable > 192
&& (_DWORD)CachedResidentAvailable != -1
&& (_DWORD)CachedResidentAvailable == _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
192,
CachedResidentAvailable) )
{
v3 = (int)CachedResidentAvailable - 192 + 1i64;
}
if( v3 )
LABEL_21:
_InterlockedExchangeAdd64((volatile signed __int64 *)&Partition->Vp.ResidentAvailablePages, v3);
}
else
{
v8 = MiMapPageInHyperSpaceWorker(v6, &OldIrql, 0x80000000ui64);
v9 = v8;
v10 = 1024i64;
if( ((unsigned __int8)v8 & 4) != 0 )
{
*v8 = 0;
v9 = v8 + 1;
v10 = 1023i64;
}
memset(v9, 0, 8 * (v10 >> 1));
if( (v10 & 1) != 0 )
*((_DWORD *)v9 + v10 - 1) = 0;
MiUnmapPageInHyperSpaceWorker(v8, OldIrql, 0x80000000ui64);
_InterlockedAdd64((_QWORD *)&stru_140C4DB30 + 839, 1ui64);
}
return v7;
}
return -1;
}Referenced by:
MiMapPageFileHash