MiPrefetchReleasePreallocatedPages
VOID __stdcall MiPrefetchReleasePreallocatedPages(INT64 a1, INT64 a2, INT64 a3, INT64 a4){
int v5;
_MMPFN *v6;
unsigned __int64 v9;
struct _KPRCB *CurrentPrcb;
__int64 CachedResidentAvailable;
bool v12;
signed __int32 v13;
*(_QWORD *)a1 = 0i64;
*(_QWORD *)(a1 + 8) = 0i64;
v5 = a4;
v6 = *(_MMPFN **)(a2 + 88);
if( v6 )
{
MiFreePageChain(v6);
*(_QWORD *)(a2 + 88) = 0i64;
}
if( v5 && *(_DWORD *)(a1 + 16) )
{
v9 = 512i64;
MiReturnCommit((_MI_PARTITION *)a3, 0x200ui64);
if( (_MI_PARTITION *)a3 != &Irp )
goto LABEL_16;
CurrentPrcb = KeGetCurrentPrcb();
CachedResidentAvailable = (int)CurrentPrcb->CachedResidentAvailable;
if( (_DWORD)CachedResidentAvailable == -1 )
goto LABEL_16;
if( (unsigned __int64)(CachedResidentAvailable + 512) <= 0x100 )
{
do
{
v13 = _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
CachedResidentAvailable + 512,
CachedResidentAvailable);
v12 = (_DWORD)CachedResidentAvailable == v13;
LODWORD(CachedResidentAvailable) = v13;
if( v12 )
goto LABEL_17;
}
while( v13 != -1 && (unsigned __int64)(v13 + 512i64) <= 0x100 );
}
if( (int)CachedResidentAvailable > 192
&& (_DWORD)CachedResidentAvailable != -1
&& (_DWORD)CachedResidentAvailable == _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
192,
CachedResidentAvailable) )
{
v9 = (int)CachedResidentAvailable - 192 + 512i64;
}
if( v9 )
LABEL_16:
_InterlockedExchangeAdd64((volatile signed __int64 *)(a3 + 7168), v9);
LABEL_17:
*(_DWORD *)(a1 + 16) = 0;
}
}Referenced by:
MiPrefetchPreallocatePages
MiPrefetchVirtualMemory