Upravit

Sdílet prostřednictvím


File Creation by a USB I/O Target

Warning

UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2.

The archived UMDF 1 samples can be found in the Windows 11, version 22H2 - May 2022 Driver Samples Update.

For more info, see Getting Started with UMDF.

During its initialization, the USB I/O target creates an intra-stack file object, which represents a default session that the USB I/O target keeps open. For more information about an intra-stack file object, see Creating a File Object to Handle I/O. The USB I/O target or its USB pipe target children use this file object to send any I/O that they originate (for example, I/O to obtain the USB configuration descriptor).

The driver can use this intra-stack file object in format functions (for example, the driver can pass a pointer to this file object to the pFile parameter in a call to the IWDFIoTarget::FormatRequestForRead method) if the driver must send I/O on this file object's default session. To obtain the intra-stack file object, the driver can call the IWDFIoTarget::GetTargetFile method.

This intra-stack file object is closed when the I/O target is disposed of either explicitly, when the driver calls the IWDFObject::DeleteWdfObject method on the I/O target, or implicitly, when the I/O target's parent is disposed of.

If any I/O remains outstanding on this intra-stack file object at the time of device removal, this file object will fail to close, and UMDF will generate a driver stop. For more information, see Creating and Using Driver-Created File Objects.