MiReleaseWriteInProgressCharges
VOID __stdcall MiReleaseWriteInProgressCharges(_MI_PARTITION *Partition, UINT64 NumberOfPages, UINT64 ReleaseCommit){
unsigned __int64 v3;
struct _KPRCB *CurrentPrcb;
__int64 CachedResidentAvailable;
bool v7;
signed __int32 v8;
signed __int32 v9;
v3 = NumberOfPages;
if( (_DWORD)ReleaseCommit )
{
MiReturnCommit(Partition, NumberOfPages);
if( Partition == &Irp )
{
CurrentPrcb = KeGetCurrentPrcb();
CachedResidentAvailable = (int)CurrentPrcb->CachedResidentAvailable;
if( (_DWORD)CachedResidentAvailable != -1 )
{
if( v3 + CachedResidentAvailable <= 0x100 )
{
do
{
if( v3 >= 0x80000 )
break;
v8 = _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
CachedResidentAvailable + v3,
CachedResidentAvailable);
v7 = (_DWORD)CachedResidentAvailable == v8;
LODWORD(CachedResidentAvailable) = v8;
if( v7 )
return;
}
while( v8 != -1 && v3 + v8 <= 0x100 );
}
LABEL_8:
if( (int)CachedResidentAvailable > 192
&& (_DWORD)CachedResidentAvailable != -1
&& (_DWORD)CachedResidentAvailable == _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
192,
CachedResidentAvailable) )
{
v3 += (int)CachedResidentAvailable - 192;
}
}
}
}
else if( Partition == &Irp )
{
CurrentPrcb = KeGetCurrentPrcb();
CachedResidentAvailable = (int)CurrentPrcb->CachedResidentAvailable;
if( (_DWORD)CachedResidentAvailable != -1 )
{
if( v3 + CachedResidentAvailable <= 0x100 )
{
do
{
if( v3 >= 0x80000 )
break;
v9 = _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
CachedResidentAvailable + v3,
CachedResidentAvailable);
v7 = (_DWORD)CachedResidentAvailable == v9;
LODWORD(CachedResidentAvailable) = v9;
if( v7 )
return;
}
while( v9 != -1 && v3 + v9 <= 0x100 );
}
goto LABEL_8;
}
}
if( v3 )
_InterlockedExchangeAdd64((volatile signed __int64 *)&Partition->Vp.ResidentAvailablePages, v3);
}Referenced by:
MiBuildMappedCluster
MiFreeModWriterEntry
MiGatherPagefilePages
MiWriteComplete