Creating a File Object to Handle I/O

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.

When an application opens a file handle, the I/O manager creates a file object. The framework in turn creates a framework file object to represent the I/O manager's file object.

Unless the driver sets the UmdfFileObjectPolicy directive to AllowNullAndUnknownFileObjects, UMDF requires each I/O request to be associated with a file object. For more information about this directive, see Specifying WDF Directives in INF Files.

If your UMDF driver sends I/O that is independent of the application to the next driver in the stack (for example, during device initialization or to get notification of device events), the driver must create its own file object to associate with the request.

The following sections describe the differences between driver-created file objects and application-created file objects, and how the driver creates and uses a file object.