IoMakeAssociatedIrp function (ntddk.h)

This routine is reserved for use by file systems and file system filter drivers. The IoMakeAssociatedIrp routine allocates and initializes an IRP to be associated with a master IRP sent to a highest-level driver, allowing the caller to split the original request and send associated IRPs on to lower-level drivers.


PIRP IoMakeAssociatedIrp(
  [in] PIRP  Irp,
  [in] CCHAR StackSize


[in] Irp

Pointer to the master IRP that was input to a highest-level driver's Dispatch routine.

[in] StackSize

Specifies the number of stack locations to be allocated for the associated IRP. The value must be at least equal to the StackSize of the next-lower driver's device object, but the associated IRP can have an additional stack location for the caller.

Return value

IoMakeAssociatedIrp returns a pointer to the associated IRP or returns a NULL pointer if an IRP cannot be allocated.


Only a highest-level driver can call this routine.

The I/O manager completes the master IRP automatically when lower drivers have completed all associated IRPs as long as the caller has not set its IoCompletion routine in an associated IRP and returned STATUS_MORE_PROCESSING_REQUIRED from its IoCompletion routine. In these circumstances, the caller must explicitly complete the master IRP when that driver has determined that all associated IRPs were completed.

Only the master IRP is associated with a thread; associated IRPs are not. For this reason, the I/O manager cannot call Cancel routines for associated IRPs when a thread exits. When the master IRP's thread exits, the I/O manager calls the master IRP's Cancel routine. The Cancel routine is responsible for tracking down all associated IRPs and calling IoCancelIrp to cancel them.


Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header ntddk.h (include Ntddk.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe

See also