EvtIoTargetRemoveComplete function

[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.

Syntax


EVT_WDF_IO_TARGET_REMOVE_COMPLETE EvtIoTargetRemoveComplete;

VOID EvtIoTargetRemoveComplete(
  _In_ WDFIOTARGET IoTarget
)
{ ... }

Parameters

IoTarget [in]

A handle to an I/O target object.

Return value

None

Remarks

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.

Examples

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:


EVT_WDF_IO_TARGET_REMOVE_COMPLETE  MyIoTargetRemoveComplete;

Then, implement your callback function as follows:


_Use_decl_annotations_
VOID
 MyIoTargetRemoveComplete (
    WDFIOTARGET  IoTarget
    )
  {...}

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.

Requirements

Target platform

Universal

Minimum KMDF version

1.0

Minimum UMDF version

2.0

Header

WdfIoTarget.h (include Wdf.h)

IRQL

PASSIVE_LEVEL

See also

EvtIoTargetRemoveCanceled
EvtIoTargetQueryRemove
WDF_IO_TARGET_OPEN_PARAMS
WdfIoTargetClose

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft