Adding a Device
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.
The framework adds a device object for each device loaded in the driver host process. To add the device, the framework calls the driver's IDriverEntry::OnDeviceAdd method and passes the IWDFDriver and IWDFDeviceInitialize interfaces in the call. The supplied IWDFDeviceInitialize interface is only valid before the driver calls IWDFDriver::CreateDevice. The driver can call the following methods of IWDFDeviceInitialize to perform the following operations:
The driver calls the IWDFDeviceInitialize::RetrieveDevicePropertyStore method to retrieve the IWDFNamedPropertyStore interface for the device property store. The driver can use IWDFNamedPropertyStore to retrieve and set properties for the device.
The driver calls the IWDFDeviceInitialize::SetLockingConstraint method to specify how its callback functions are called by the framework.
The driver calls the IWDFDeviceInitialize::SetFilter method to enable the device as a filter device.
After the driver uses IWDFDeviceInitialize to initialize the device, the driver passes a pointer to IWDFDeviceInitialize in a call to the IWDFDriver::CreateDevice method to create a UMDF device object for the device. After the framework device object is created, the driver makes calls to the IWDFDevice::CreateIoQueue method to create read and write I/O queues. In these IWDFDevice::CreateIoQueue calls, the driver must identify how it receives requests from the I/O queue. For more information, see Configuring Dispatch Mode for an I/O Queue.