ExReturnPoolQuota

VOID __stdcall ExReturnPoolQuota(VOID *P){
  char v2; 
  _EPROCESS *BilledProcess; 
  __int64 v4; 
  UINT64 v5; 
  char *v6; 
  __int16 v7; 

  if( !ExpSpecialAllocations || (LODWORD(v5) = ExGetHeapFromVA(P), !ExpHpIsSpecialPoolHeap(v5)) )
  {
    v2 = *((char *)P - 13);
    if( (v2 & 8) != 0 )
    {
      BilledProcess = ExpGetBilledProcess((_POOL_HEADER *)P - 1);
      if( BilledProcess )
      {
        v4 = (unsigned __int8)*((_WORD *)P - 7);
        if( (v2 & 4) != 0 )
        {
          v6 = (char *)P - 16 * (unsigned __int8)*((_WORD *)P - 8) - 16;
          v7 = *((_WORD *)v6 + 1);
          v6[3] &= ~8u;
          v4 = (unsigned __int8)v7;
        }
        *((char *)P - 13) &= ~8u;
        PsReturnPoolQuota(BilledProcess, (POOL_TYPE)(v2 & 1), (PVOID)(16 * v4));
        ObDereferenceObjectDeferDeleteWithTag((UINT64)BilledProcess, *((unsigned int *)P - 3));
      }
    }
  }
}

Referenced by:

IopCompleteRequest
IopFreeIrp
IopFreeMiniCompletionPacket