IoSetCompletionRoutineEx function (wdm.h)
The IoSetCompletionRoutineEx routine registers an IoCompletion routine, which is called when the next-lower-level driver has completed the requested operation for the given IRP.
Syntax
NTSTATUS IoSetCompletionRoutineEx(
[in] PDEVICE_OBJECT DeviceObject,
[in] PIRP Irp,
[in] PIO_COMPLETION_ROUTINE CompletionRoutine,
[in, optional] PVOID Context,
[in] BOOLEAN InvokeOnSuccess,
[in] BOOLEAN InvokeOnError,
[in] BOOLEAN InvokeOnCancel
);
Parameters
[in] DeviceObject
Pointer to the driver's device object.
[in] Irp
Pointer to the IRP that the driver is processing.
[in] CompletionRoutine
Specifies the entry point for the driver-supplied IoCompletion routine, which is called when the next-lower driver completes the packet.
[in, optional] Context
Pointer to a driver-determined context to pass to the IoCompletion routine. Context information must be stored in nonpaged memory, because the IoCompletion routine is called at IRQL <= DISPATCH_LEVEL.
[in] InvokeOnSuccess
Specifies whether the completion routine is called if the IRP is completed with a success status value in the IRP's IO_STATUS_BLOCK structure, based on results of the NT_SUCCESS macro (see Using NTSTATUS values).
[in] InvokeOnError
Specifies whether the completion routine is called if the IRP is completed with a nonsuccess status value in the IRP's IO_STATUS_BLOCK structure.
[in] InvokeOnCancel
Specifies whether the completion routine is called if a driver or the kernel has called IoCancelIrp to cancel the IRP.
Return value
This routine returns STATUS_SUCCESS on success, or STATUS_INSUFFICIENT_RESOURCES if insufficient memory is available for the operation.
Remarks
The behavior of IoSetCompletionRoutineEx is the same as the IoSetCompletionRoutine routine, except that:
- IoSetCompletionRoutineEx guarantees that a non-Plug and Play driver is not unloaded before the IoCompletion routine runs.
- IoSetCompletionRoutineEx is a routine that returns an NTSTATUS value.
Requirements
See also
Feedback
Submit and view feedback for