IopAllocateIrpExtension

_IOP_IRP_EXTENSION *__stdcall IopAllocateIrpExtension(_IRP *Irp, _IRP_EXTENSION_TYPE Type){
  _IOP_IRP_EXTENSION *IrpExtension; 
  char v3; 
  VOID **PoolWithTag; 
  VOID **v7; 

  IrpExtension = (_IOP_IRP_EXTENSION *)Irp->Tail.IrpExtension;
  v3 = Type;
  if( !IrpExtension )
  {
    if( Type != IopGenericType )
    {
      PoolWithTag = ExAllocatePoolWithTag(0x200ui64, 0x40ui64, 1483764297i64);
      IrpExtension = (_IOP_IRP_EXTENSION *)PoolWithTag;
      if( !PoolWithTag )
        return IrpExtension;
      memset(PoolWithTag, 0i64, 0x40u);
      IrpExtension->TypesAllocated = 1 << v3;
      Irp->AllocationFlags |= 0x40u;
LABEL_10:
      Irp->Tail.IrpExtension = IrpExtension;
      IrpExtension->ExtensionFlags |= 1u;
      return IrpExtension;
    }
    Irp->AllocationFlags |= 0x80u;
    return(_IOP_IRP_EXTENSION *)((char *)&Irp->Tail.OriginalFileObject + 4);
  }
  if( (Irp->AllocationFlags & 0x80u) != 0 )
  {
    if( Type != IopGenericType )
    {
      v7 = ExAllocatePoolWithTag(0x200ui64, 0x40ui64, 1483764297i64);
      IrpExtension = (_IOP_IRP_EXTENSION *)v7;
      if( !v7 )
        return IrpExtension;
      memset(v7, 0i64, 0x40u);
      IrpExtension->TypesAllocated = (1 << (v3 & 0xF)) | 4;
      *(_DWORD *)IrpExtension->GenericExtension = Irp->Tail.IrpExtension;
      Irp->AllocationFlags = Irp->AllocationFlags & 0x3F | 0x40;
      goto LABEL_10;
    }
    return(_IOP_IRP_EXTENSION *)((char *)&Irp->Tail.OriginalFileObject + 4);
  }
  IrpExtension->TypesAllocated |= 1 << Type;
  return IrpExtension;
}

Referenced by:

IoClearAdapterCryptoEngineExtension
IoPropagateIrpExtensionEx
IoSetActivityIdIrp
IoSetAdapterCryptoEngineExtension
IoSetFsTrackOffsetState
IoSetFsZeroingOffsetRequired
IoSetGenericIrpExtension
IopPerfCallDriver
IopSetDiskIoAttributionExtension
IopSetDriverFlagsExtension
ViGetContextPointer