MiGetCrossPartitionCombineCharges
NTSTATUS __stdcall MiGetCrossPartitionCombineCharges(_MI_PARTITION *Partition, INT64 a2){
int v2;
unsigned __int64 v4;
int v5;
struct _KPRCB *CurrentPrcb;
__int64 CachedResidentAvailable;
bool v8;
signed __int32 v9;
v2 = a2;
v4 = 1i64;
if( (_DWORD)a2 )
{
MiAcquireNonPagedResources(Partition, 1ui64);
if( v5 < 0 )
return 0;
}
if( MiGetCrossPartitionCharges((_MI_CROSS_PARTITION_CHARGES *)Partition, 2ui64, 1i64) < 0 )
{
if( v2 )
{
MiReturnCommit(Partition, 1ui64);
if( Partition != &Irp )
goto LABEL_16;
CurrentPrcb = KeGetCurrentPrcb();
CachedResidentAvailable = (int)CurrentPrcb->CachedResidentAvailable;
if( (_DWORD)CachedResidentAvailable == -1 )
goto LABEL_16;
if( (unsigned __int64)(CachedResidentAvailable + 1) <= 0x100 )
{
do
{
v9 = _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
CachedResidentAvailable + 1,
CachedResidentAvailable);
v8 = (_DWORD)CachedResidentAvailable == v9;
LODWORD(CachedResidentAvailable) = v9;
if( v8 )
return 0;
}
while( v9 != -1 && (unsigned __int64)(v9 + 1i64) <= 0x100 );
}
if( (int)CachedResidentAvailable > 192
&& (_DWORD)CachedResidentAvailable != -1
&& (_DWORD)CachedResidentAvailable == _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
192,
CachedResidentAvailable) )
{
v4 = (int)CachedResidentAvailable - 192 + 1i64;
}
if( v4 )
LABEL_16:
_InterlockedExchangeAdd64((volatile signed __int64 *)&Partition->Vp.ResidentAvailablePages, v4);
}
return 0;
}
return 1;
}Referenced by:
MiConvertPrivateToProto
MiConvertStandbyToProto
MiIncrementCombinedPte