信息
您所需的主题如下所示。但此主题未包含在此库中。

WdfIoTargetClose 方法

The WdfIoTargetClose method closes a specified remote I/O target.

语法

VOID WdfIoTargetClose(
  [in]  WDFIOTARGET IoTarget
);

参数

IoTarget [in]

A handle to an 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.

评论

After a driver has called WdfIoTargetClose, it can call WdfIoTargetOpen to reopen the remote I/O target.

Drivers that supply an EvtIoTargetRemoveComplete callback function must call WdfIoTargetClose from within that callback function.

Before the WdfIoTargetClose method returns, the framework cancels all of the target queue's I/O requests.

If a driver has finished using a remote I/O target and will not use the target again, the driver can call WdfObjectDelete without first calling WdfIoTargetClose. The call to WdfObjectDelete will close the remote I/O target, cancel all of the target queue's I/O requests, and delete the I/O target object. (Note that if the remote I/O target's parent object is a device object, the framework closes the target and deletes the target object when it deletes the parent object.)

For more information about WdfIoTargetClose, 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 an EvtIoTargetRemoveComplete callback function that removes a specified I/O target from a driver's collection of I/O targets and then closes the I/O target.

VOID
MyEvtIoTargetRemoveComplete(
    WDFIOTARGET IoTarget
)
{
    //
    // Get device information from the I/O target object's
    // context space.
    //
    targetDeviceInfo = GetTargetDeviceInfo(IoTarget);
    deviceExtension = targetDeviceInfo->DeviceExtension;

    //
    // Remove the target device from the collection.
    //
    WdfWaitLockAcquire(
                       deviceExtension->TargetDeviceCollectionLock,
                       NULL
                       );

    WdfCollectionRemove(
                        deviceExtension->TargetDeviceCollection,
                        IoTarget
                        );

    WdfWaitLockRelease(deviceExtension->TargetDeviceCollectionLock);

    //
    // Close the target.
    //
    WdfIoTargetClose(IoTarget);
}

要求

版本

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

另请参见

EvtIoTargetRemoveComplete
WdfIoTargetCreate

 

 

社区附加资源

显示:
© 2014 Microsoft