This function obtains an I/O Request Packet (IRP).


IoAllocateIrpEx (
    DEVICE_OBJECT *DeviceObject, 
    CHAR StackSize, 
    BOOLEAN ChargeQuota);


The DeviceObject argument is the address of a DEVICE_OBJECT that represents the device that the request will be sent to. This argument can be NULL.

The StackSize argument is the desired number of I/O stack locations to provide with the IRP.

A non-zero ChargeQuota (typically) causes the size of the IRP memory block to be charged against the current process’s quota.

Return Value

If successful, the function returns the address of the IRP. If not, it returns NULL.


The IoAllocateIrpEx function is exported by name from the kernel in version 10.0 and higher.

Documentation Status

The IoAllocateIrpEx function is not documented. It is, however, declared in WDM.H.


The IoAllocateIrpEx function is the ancient, documented IoAllocateIrp function except for having the DeviceObject argument as elaboration. The only known purpose to the elaboration is to help device objects that anticipate receiving requests that carry additional parameters in an IRP extension. Such a DEVICE_OBJECT has a set DO_DEVICE_IRP_REQUIRES_EXTENSION bit (0x08000000) in its Flags. Requests for such device objects are prepared and managed more efficiently if the IRP extension is in the same memory block as the IRP and its I/O stack locations. This arrangement is produced by this function.

If the given device object requires an IRP extension in I/O request packets that are sent to it, this function obtains an IRP that has space for a greater StackSize and then uses the excess as an IOP_IRP_EXTENSION instead of an IO_STACK_LOCATION (or two, since the former in 32-bit Windows 10 is larger than one of the latter). The whole IRP then has the following items in the following order:

If no device object is given or the relevant Flags bit is clear, then the IRP has just the fixed-size IRP and the I/O stack locations, as usual.