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
);
IoMakeAssociatedIrp returns a pointer to the associated IRP or returns a NULL pointer if an IRP cannot be allocated.
Declared in ntddk.h. Include ntddk.h.
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.
Callers of IoMakeAssociatedIrp must be running at IRQL <= DISPATCH_LEVEL.
IoAllocateIrp, IoBuildAsynchronousFsdRequest, IoBuildDeviceIoControlRequest, IoBuildSynchronousFsdRequest, IoCallDriver, IoSetCompletionRoutine, IRP