Previous Next

IoMakeAssociatedIrp

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
    );

Parameters

Irp
Pointer to the master IRP that was input to a highest-level driver’s Dispatch routine.
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.

Headers

Declared in ntddk.h. Include ntddk.h.

Comments

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.

See Also

IoAllocateIrp, IoBuildAsynchronousFsdRequest, IoBuildDeviceIoControlRequest, IoBuildSynchronousFsdRequest, IoCallDriver, IoSetCompletionRoutine, IRP