MiGetCrossPartitionCloneCharges
NTSTATUS __stdcall MiGetCrossPartitionCloneCharges(INT64 a1){
unsigned __int64 v2;
struct _KPRCB *CurrentPrcb;
__int64 CachedResidentAvailable;
bool v5;
signed __int32 v6;
v2 = 1i64;
if( MiChargeResident((ULONG_PTR *)a1, 1ui64, 0i64) == MiChargeFailed )
return 0;
if( MiGetCrossPartitionCharges((_MI_CROSS_PARTITION_CHARGES *)a1, 6ui64, 0i64) < 0 )
{
if( (_MI_PARTITION *)a1 != &Irp )
goto LABEL_14;
CurrentPrcb = KeGetCurrentPrcb();
CachedResidentAvailable = (int)CurrentPrcb->CachedResidentAvailable;
if( (_DWORD)CachedResidentAvailable == -1 )
goto LABEL_14;
if( (unsigned __int64)(CachedResidentAvailable + 1) <= 0x100 )
{
do
{
v6 = _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
CachedResidentAvailable + 1,
CachedResidentAvailable);
v5 = (_DWORD)CachedResidentAvailable == v6;
LODWORD(CachedResidentAvailable) = v6;
if( v5 )
return 0;
}
while( v6 != -1 && (unsigned __int64)(v6 + 1i64) <= 0x100 );
}
if( (int)CachedResidentAvailable > 192
&& (_DWORD)CachedResidentAvailable != -1
&& (_DWORD)CachedResidentAvailable == _InterlockedCompareExchange(
(volatile signed __int32 *)&CurrentPrcb->CachedResidentAvailable,
192,
CachedResidentAvailable) )
{
v2 = (int)CachedResidentAvailable - 192 + 1i64;
}
if( v2 )
LABEL_14:
_InterlockedExchangeAdd64((volatile signed __int64 *)(a1 + 7168), v2);
return 0;
}
return 1;
}Referenced by:
MiBuildForkPte
MiHandleForkTransitionPte
MiReferenceCloneProto