ViIrpAllocateLockedPacket

_IOV_REQUEST_PACKET *__stdcall ViIrpAllocateLockedPacket(INT8 StackSize, UINT64 ChargeQuota, VOID *CallerAddress){
  int v4; 
  _IOV_REQUEST_PACKET *v5; 
  UINT16 v6; 
  _IRP *PoolWithTagPriority; 
  _CCHAR v8; 
  unsigned int v9; 
  _EPROCESS *Process; 
  _IOV_REQUEST_PACKET *v11; 

  v4 = ChargeQuota;
  v5 = 0i64;
  v6 = 72 * StackSize + 208;
  PoolWithTagPriority = (_IRP *)VeAllocatePoolWithTagPriority(
                                  (POOL_TYPE)640,
                                  v6,
                                  0x2B707249ui64,
                                  HighPoolPriority,
                                  CallerAddress);
  if( PoolWithTagPriority )
  {
    v9 = 0;
    Process = 0i64;
    if( v4
      && (v9 = 4096,
          Process = KeGetCurrentThread()->ApcState.Process,
          PsChargeProcessNonPagedPoolQuota(Process, 0x1000ui64) < 0) )
    {
      ExFreePoolWithTag(PoolWithTagPriority, 0);
    }
    else
    {
      LOBYTE(v8) = StackSize;
      IoInitializeIrp(PoolWithTagPriority, v6, v8);
      v11 = VfPacketCreateAndLock(PoolWithTagPriority);
      v5 = v11;
      if( v11 )
      {
        v11[14] |= 0x200008u;
        _InterlockedIncrement(v11 + 5);
        ++v11[6];
        PoolWithTagPriority->Flags |= 0x40000000u;
        if( v4 )
        {
          PoolWithTagPriority->AllocationFlags |= 1u;
          v11[21] = v9;
          *((_QWORD *)v11 + 11) = Process;
          ObfReferenceObjectWithTag(Process, 0x49667256ui64);
        }
      }
      else
      {
        ExFreePoolWithTag(PoolWithTagPriority, 0);
        if( v4 )
          PsReturnProcessNonPagedPoolQuota(Process, v9);
      }
    }
  }
  return v5;
}

Referenced by:

IovAllocateIrp