WdfIoTargetCloseForQueryRemove 函数 (wdfiotarget.h)

[适用于 KMDF 和 UMDF]

WdfIoTargetCloseForQueryRemove 方法暂时关闭指定的 远程 I/O 目标,因为目标设备可能很快被删除。

语法

void WdfIoTargetCloseForQueryRemove(
  [in] WDFIOTARGET IoTarget
);

参数

[in] IoTarget

从上一次调用 WdfIoTargetCreate获取的远程 I/O 目标对象的句柄。

返回值

没有

注解

如果驱动程序提供无效的对象句柄,则会发生 bug 检查。

提供 EvtIoTargetQueryRemove 回调函数的驱动程序必须从该回调函数中调用 WdfIoTargetCloseForQueryRemove(如果驱动程序确定可以安全删除目标设备)。

有关 WdfIoTargetCloseForQueryRemove的详细信息,请参阅 控制常规 I/O 目标的状态

有关 I/O 目标的详细信息,请参阅 使用 I/O 目标

例子

以下代码示例是来自 烤箱 示例驱动程序的 EvtIoTargetQueryRemove 回调函数。 该函数停止计时器,确保以前提交的工作项已得到服务,然后调用 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;
}

要求

要求 价值
目标平台 普遍
最低 KMDF 版本 1.0
最低 UMDF 版本 2.0
标头 wdfiotarget.h (包括 Wdf.h)
图书馆 Wdf01000.sys(KMDF):WUDFx02000.dll (UMDF)
IRQL PASSIVE_LEVEL
DDI 符合性规则 DriverCreate(kmdf)KmdfIrql(kmdf)KmdfIrql2(kmdf),KmdfIrqlExplicit(kmdf)

另请参阅

EvtIoTargetQueryRemove

WdfIoTargetCreate