WdfIoTargetCloseForQueryRemove method

WdfIoTargetCloseForQueryRemove 方法

The WdfIoTargetCloseForQueryRemove method temporarily closes a specified remote I/O target because the target device might soon be removed.

语法

VOID WdfIoTargetCloseForQueryRemove(
  [in]  WDFIOTARGET IoTarget
);

参数

IoTarget [in]

A handle to a remote I/O target object that was obtained from a previous call to WdfIoTargetCreate.

返回值

None.

A bug check occurs if the driver supplies an invalid object handle.

评论

Drivers that supply an EvtIoTargetQueryRemove callback function must call WdfIoTargetCloseForQueryRemove from within that callback function, if the driver determines that the target device can be safely removed.

For more information about WdfIoTargetCloseForQueryRemove, see Controlling a General I/O Target's State.

For more information about I/O targets, see Using I/O Targets.

示例

The following code example is the EvtIoTargetQueryRemove callback function from the Toaster sample driver. The function stops a timer, ensures that a previously submitted work item has been serviced, and then calls WdfIoTargetCloseForQueryRemove.

NTSTATUS
ToastMon_EvtIoTargetQueryRemove(
    WDFIOTARGET IoTarget
)
{
    PTARGET_DEVICE_INFO  targetDeviceInfo = NULL;

    //
    // Get I/O target object's context space.
    //
    targetDeviceInfo = GetTargetDeviceInfo(IoTarget);

    //
    // Stop the timer and wait for any outstanding work items
    // to finish before closing the target.
    //
    WdfTimerStop(targetDeviceInfo->TimerForPostingRequests, TRUE);
    WdfWorkItemFlush(targetDeviceInfo->WorkItemForPostingRequests);

    WdfIoTargetCloseForQueryRemove(IoTarget);

    return STATUS_SUCCESS;
}

要求

版本

Available in version 1.0 and later versions of KMDF.

标头

Wdfiotarget.h (包括Wdf.h)

Wdf<MajorVersionNumber>000.sys (see Framework Library Versions.)

IRQL

PASSIVE_LEVEL

另请参见

EvtIoTargetQueryRemove
WdfIoTargetCreate

 

 

社区附加资源

添加
显示:
© 2016 Microsoft