MiChargeProcessCommitment

UINT64 __stdcall MiChargeProcessCommitment(_EPROCESS *Process, UINT64 QuotaCharge){
  signed __int64 v2; 
  unsigned __int64 v3; 
  unsigned __int64 v4; 
  unsigned __int64 v5; 
  signed __int64 v7; 
  unsigned __int64 v8; 
  if( *((_QWORD *)Process + 200) )
  {
    v2 = *((_QWORD *)Process + 201);
    while( 1 )
    {
      v7 = v2;
      v8 = QuotaCharge + v2;
      if( v8 > *((_QWORD *)Process + 200) )
        break;
      v2 = _InterlockedCompareExchange64((volatile signed __int64 *)Process + 201, v8, v7);
      if( v7 == v2 )
        goto LABEL_3;
    }
    if( *((_QWORD *)Process + 162) )
      PsReportProcessMemoryLimitViolation();
    return 0i64;
  }
  else
  {
    v2 = _InterlockedExchangeAdd64((volatile signed __int64 *)Process + 201, QuotaCharge);
LABEL_3:
    v3 = *((_QWORD *)Process + 202);
    v4 = QuotaCharge + v2;
    do
    {
      v5 = v3;
      if( v4 <= v3 )
        break;
      v3 = _InterlockedCompareExchange64((volatile signed __int64 *)Process + 202, v4, v3);
    }
    while( v3 != v5 );
    return 1i64;
  }
}

Referenced by:

MiAllocateUserPhysicalPages
MiChargeFullProcessCommitment