Accessing device driver properties

In Windows Vista and later versions of Windows, the unified device property model includes device driver properties that characterize a device driver. The unified device property model uses property keys to represent these properties.

Windows Server 2003, Windows XP, and Windows 2000 also support most of these device driver properties. However, these earlier versions of Windows do not support the property keys of the unified device property model. Instead, these versions of Windows use the following mechanisms to represent and access the corresponding property information:

To maintain compatibility with these earlier versions of Windows, Windows Vista and later versions also support these two ways to access information about a device interface. However, you should use the property keys to access these properties on Windows Vista and later versions. For information about how to use property keys to access device driver properties on Windows Vista and later versions, see Accessing Device Instance Properties (Windows Vista and Later).

Accessing device driver properties that have corresponding registry entry values

To access device driver properties on Windows Server 2003, Windows XP, and Windows 2000, follow these steps:

  1. Retrieve a handle to the software key for a device instance by calling CM_Open_DevNode_Key with a ulFlags of CM_REGISTRY_SOFTWARE or SetupDiOpenDevRegKey with a Scope of DICS_FLAG_GLOBAL and a KeyType of DIREG_DRV.

  2. Supply the handle in a call to RegQueryValueEx or to RegSetValueEx to retrieve or set the registry entry value that corresponds to the device instance driver property.

  3. Call the RegCloseKey function to close the software registry key after access to the key is no longer required.

A table of unified device property model properties and their corresponding registry values in the software key for a device is:

Unified property model property Software key registry value name (defined in regstr.h)
DEVPKEY_Device_DriverDate REGSTR_VAL_DRIVERDATEDATA
DEVPKEY_Device_DriverVersion REGSTR_VAL_DRIVERVERSION
DEVPKEY_Device_DriverDesc REGSTR_VAL_DRVDESC
DEVPKEY_Device_DriverInfPath REGSTR_VAL_INFPATH
DEVPKEY_Device_DriverInfSection REGSTR_VAL_INFSECTION
DEVPKEY_Device_DriverInfSectionExt REGSTR_VAL_INFSECTIONEXT
DEVPKEY_Device_DriverProvider REGSTR_VAL_PROVIDER_NAME

Using SetupDiGetDriverInstallParams to retrieve driver rank

On Windows Server 2003, Windows XP, and Windows 2000, you can retrieve the rank of a driver that is currently installed for a device by calling SetupDiGetDriverInstallParams. SetupDiGetDriverInstallParams retrieves a pointer to an SP_DRVINSTALL_PARAMS structure for the driver in the output parameter DriverInstallParams. The Rank member of the retrieved SP_DRVINSTALL_PARAMS structure contains the driver rank.