Redigera

Dela via


Accessing the unified device property model

This topic describes how a Windows Driver Frameworks (WDF) driver retrieves or modifies properties that are exposed through the unified device property model. The methods listed are available starting in User-Mode Driver Framework (UMDF) version 2.0 and Kernel-Mode Driver Framework (KMDF) version 1.13.

Both KMDF and UMDF drivers can call the following methods:

Both KMDF and UMDF drivers can call the following methods only before calling WdfDeviceCreate. For more information about calling WdfDeviceCreate, see Creating a Framework Device Object.

After calling WdfDeviceCreate, a driver can obtain device property information by calling the corresponding WdfDeviceXxxProperty method.

The -Ex methods above differ from their non-Ex counterparts in that they allow you to specify properties using the WDF_DEVICE_PROPERTY_DATA structure, instead of the subset that you can specify using DEVICE_REGISTRY_PROPERTY.

Before receiving device property data, drivers typically call WdfXxxQueryProperty just to obtain the required buffer size. For some properties, the data size can change between when the required size is returned and when the driver calls WdfXxxQueryProperty again. Therefore, drivers should call WdfXxxQueryProperty inside a loop that executes until the return status is not STATUS_BUFFER_TOO_SMALL.

It is best to use WdfXxxQueryProperty only if the required buffer size is known and unchanging, because in that case the driver has to call WdfXxxQueryProperty only once. If the required buffer size is unknown or varies, the driver should call WdfXxxAllocAndQueryProperty.

Accessing device interface properties

UMDF drivers can use the following methods to retrieve or modify device interface properties that are exposed through the unified property model:

To retrieve or modify a device interface property, a KMDF driver must call IoGetDeviceInterfacePropertyData or IoSetDeviceInterfacePropertyData directly.