PspChargeQuota
INT64 __fastcall PspChargeQuota(INT64 a1, INT64 a2, INT64 a3, UINT64 a4){
__int64 v4;
unsigned __int64 *v7;
char v8;
unsigned __int64 v9;
UINT64 v10;
unsigned __int64 v11;
bool v12;
signed __int64 v13;
unsigned __int64 v14;
unsigned __int64 v16;
INT64 v17;
unsigned __int64 v18;
unsigned __int64 v19;
unsigned __int64 v20;
unsigned __int64 v21;
int v22[8];
UINT64 i;
v4 = (int)a3;
v7 = (unsigned __int64 *)(a1 + ((__int64)(int)a3 << 7));
v8 = PspResourceFlags[8 * (int)a3];
_m_prefetchw(v7);
v9 = *v7;
_InterlockedOr(v22, 0);
while( 2 )
{
v10 = v7[8];
LABEL_3:
for( i = v10; ; v10 = i )
{
v11 = v9 + a4;
if( v9 + a4 < v9 )
return *(unsigned int *)&PspResourceFlags[8 * v4 + 4];
if( v11 <= v10 )
break;
if( (v8 & 1) == 0 || !v7[10] )
return *(unsigned int *)&PspResourceFlags[8 * v4 + 4];
v21 = _InterlockedExchange64((volatile __int64 *)v7 + 9, 0i64);
if( v21 )
{
v10 = v21 + _InterlockedExchangeAdd64((volatile signed __int64 *)v7 + 8, v21);
goto LABEL_3;
}
if( !PspExpandQuota((unsigned int)v4, (INT64)v7, v9, a4, &i) )
return *(unsigned int *)&PspResourceFlags[8 * v4 + 4];
}
v13 = _InterlockedCompareExchange64((volatile signed __int64 *)v7, v11, v9);
v12 = v9 == v13;
v9 = v13;
if( !v12 )
continue;
break;
}
_m_prefetchw(v7 + 1);
v14 = v7[1];
if( v11 > v14 )
{
do
{
v20 = v14;
v14 = _InterlockedCompareExchange64((volatile signed __int64 *)v7 + 1, v11, v14);
}
while( v14 != v20 && v11 > v14 );
}
if( a2 )
{
if( (v8 & 4) != 0 )
{
v16 = a4 + _InterlockedExchangeAdd64((volatile signed __int64 *)(a2 + 8 * v4 + 1136), a4);
v17 = a2 + 8 * v4;
_m_prefetchw((const void *)(v17 + 1152));
v18 = *(_QWORD *)(v17 + 1152);
if( v16 > v18 )
{
do
{
v19 = v18;
v18 = _InterlockedCompareExchange64((volatile signed __int64 *)(v17 + 1152), v16, v18);
}
while( v18 != v19 && v16 > v18 );
}
}
}
return 0i64;
}Referenced by:
MiChargeFullProcessCommitment
MiInsertVadCharges
ObpIncrementHandleCountEx
PsChargeProcessNonPagedPoolQuota
PsChargeProcessPagedPoolQuota
PsChargeProcessPoolQuota
PsChargeProcessQuota
PsChargeSharedPoolQuota