PspReleaseReturnedQuota

UINT64 __stdcall PspReleaseReturnedQuota(
        _PS_RESOURCE_TYPE ResourceType,
        _PSP_QUOTA_EXPANSION_DESCRIPTOR *ExpansionDescriptor){
  UINT64 v2; 
  _PSP_QUOTA_EXPANSION_DESCRIPTOR *v3; 

  v2 = 0i64;
  v3 = (_PSP_QUOTA_EXPANSION_DESCRIPTOR *)*((_QWORD *)ExpansionDescriptor + 5);
  if( v3 != ExpansionDescriptor + 10 )
  {
    do
    {
      v2 += _InterlockedExchange64((volatile __int64 *)v3 - 1, 0i64);
      if( !*(_PSP_QUOTA_EXPANSION_DESCRIPTOR *)((char *)v3 + 432 - ((__int64)(int)ResourceType << 7)) )
        v2 += _InterlockedExchange64((volatile __int64 *)v3 - 2, 0i64);
      v3 = *(_PSP_QUOTA_EXPANSION_DESCRIPTOR **)v3;
    }
    while( v3 != ExpansionDescriptor + 10 );
    if( v2 )
      (*((void(__fastcall **)(_PS_RESOURCE_TYPE, UINT64))ExpansionDescriptor + 4))(ResourceType, v2);
  }
  return v2;
}

Referenced by:

PspExpandQuota