[Applies to KMDF and UMDF]

A driver's EvtIoTargetRemoveComplete event callback function performs operations when the removal of a specified remote I/O target is complete.



void EvtWdfIoTargetRemoveComplete(



A handle to an I/O target object.

Return Value



To register an EvtIoTargetRemoveComplete callback function, place the callback function's address in the I/O target's WDF_IO_TARGET_OPEN_PARAMS structure.

The framework calls your driver's EvtIoTargetRemoveComplete callback function after the driver's EvtIoTargetQueryRemove callback function returns STATUS_SUCCESS, or after the device has been removed unexpectedly (surprise-removed).

A driver's EvtIoTargetRemoveComplete callback function must permanently close the remote I/O target by calling WdfIoTargetClose. Because the target device has been removed, the EvtIoTargetRemoveComplete callback function should also perform any additional target-removal operations that might be necessary, such as releasing system resources that the driver might have allocated when it opened the target.

The EvtIoTargetRemoveComplete callback function is optional. If the driver does not supply this callback function, the framework permanently closes the I/O target.

For more information about the EvtIoTargetRemoveComplete callback function, see Controlling a General I/O Target's State.

To define an EvtIoTargetRemoveComplete callback function, you must first provide a function declaration that identifies the type of callback function you’re defining. Windows provides a set of callback function types for drivers. Declaring a function using the callback function types helps Code Analysis for Drivers, Static Driver Verifier (SDV), and other verification tools find errors, and it’s a requirement for writing drivers for the Windows operating system.

For example, to define an EvtIoTargetRemoveComplete callback function that is named MyIoTargetRemoveComplete, use the EVT_WDF_IO_TARGET_REMOVE_COMPLETE type as shown in this code example:

Then, implement your callback function as follows:

The EVT_WDF_IO_TARGET_REMOVE_COMPLETE function type is defined in the WdfIoTarget.h header file. To more accurately identify errors when you run the code analysis tools, be sure to add the Use_decl_annotations annotation to your function definition. The Use_decl_annotations annotation ensures that the annotations that are applied to the EVT_WDF_IO_TARGET_REMOVE_COMPLETE function type in the header file are used. For more information about the requirements for function declarations, see Declaring Functions by Using Function Role Types for KMDF Drivers. For information about Use_decl_annotations, see Annotating Function Behavior.


Windows Driver kit version
Target platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdfiotarget.h (include Wdf.h)
DDI compliance rules

See Also


Send comments about this topic to Microsoft