The IoSetCompletionRoutineEx routine registers an IoCompletion routine to be called when the next-lower-level driver has completed the requested operation for the given IRP.
VOID
IoSetCompletionRoutineEx(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PIO_COMPLETION_ROUTINE CompletionRoutine,
IN PVOID Context,
IN BOOLEAN InvokeOnSuccess,
IN BOOLEAN InvokeOnError,
IN BOOLEAN InvokeOnCancel
);
This routine returns STATUS_SUCCESS on success, or STATUS_INSUFFICIENT_RESOURCES if insufficient memory is available for the operation.
Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.
This routine is only available on Windows XP and later.
The behavior of IoSetCompletionRoutineEx is the same as IoSetCompletionRoutine, except that it guarantees that a non-Plug and Play driver is not unloaded before the IoCompletion routine executes.
IO_STACK_LOCATION, IoCompletion, IoAllocateIrp, IoBuildAsynchronousFsdRequest, IRP, IoBuildPartialMdl, IoFreeIrp, IoSetCompletionRoutine