EvtIoTargetQueryRemove function

[Applies to KMDF and UMDF]

A driver's EvtIoTargetQueryRemove event callback function indicates whether the framework can safely remove a specified remote I/O target's device.

Syntax


EVT_WDF_IO_TARGET_QUERY_REMOVE EvtIoTargetQueryRemove;

NTSTATUS EvtIoTargetQueryRemove(
  _In_  WDFIOTARGET IoTarget
)
{ ... }

Parameters

IoTarget [in]

A handle to an I/O target object.

Return value

TheEvtIoTargetQueryRemove callback function must return STATUS_SUCCESS if the driver determines that the framework can safely remove the specified I/O target's device. Otherwise, this callback function must return STATUS_UNSUCCESSFUL.

Remarks

If a driver's EvtIoTargetQueryRemove callback function returns STATUS_SUCCESS, the system allows the I/O target's device to be removed, unless another driver returns STATUS_UNSUCCESSFUL.

To register an EvtIoTargetQueryRemove callback function, place the callback function's address in the I/O target's WDF_IO_TARGET_OPEN_PARAMS structure. The EvtIoTargetQueryRemove callback function is optional. Not supplying this callback function is equivalent to returning STATUS_SUCCESS.

The EvtIoTargetQueryRemove callback function must call WdfIoTargetCloseForQueryRemove, if the driver determines that the PnP manager can safely remove the target device.

The callback function must disable the driver's ability to send additional I/O requests to the I/O target.

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

Examples

To define an EvtIoTargetQueryRemove 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 EvtIoTargetQueryRemove callback function that is named MyIoTargetQueryRemove, use the EVT_WDF_IO_TARGET_QUERY_REMOVE type as shown in this code example:


EVT_WDF_IO_TARGET_QUERY_REMOVE  MyIoTargetQueryRemove;

Then, implement your callback function as follows:


_Use_decl_annotations_
NTSTATUS
 MyIoTargetQueryRemove (
    WDFIOTARGET  IoTarget
    )
  {...}

The EVT_WDF_IO_TARGET_QUERY_REMOVE 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_QUERY_REMOVE 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

Minimum KMDF version

1.0

Minimum UMDF version

2.0

Header

WdfIoTarget.h (include Wdf.h)

IRQL

PASSIVE_LEVEL

See also

EvtIoTargetRemoveCanceled
EvtIoTargetRemoveComplete
WDF_IO_TARGET_OPEN_PARAMS
WdfIoTargetCloseForQueryRemove

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft