Accessing Device Instance Properties (Prior to Windows Vista)
In Windows Vista and later versions of Windows, the unified device property model supports the device instance properties that correspond to the CM_DRP_Xxx identifiers that are defined in cfgmgr32.h and the SPDRP_Xxx identifiers that are defined in Setupapi.h. These properties characterize the configuration of a device instance. The unified device property model uses property keys to represent these properties. Windows Server 2003, Windows XP, and Windows 2000 also support these device properties. However, these earlier versions of Windows do not support the property keys of the unified device property model. Instead, these earlier Windows versions use the CM_DRP_Xxx or SPDRP_Xxx identifiers to represent and access the device instance properties.
To maintain compatibility with these earlier versions of Windows, Windows Vista and later versions also support using CM_DRP_Xxx or SPDRP_Xxx identifiers to access device instance properties. However, you should use the corresponding property keys to access these properties on Windows Vista and later versions of Windows.
For a list of the system-defined device instance properties that have corresponding CM_DRP_Xxx or SPDRP_Xxx identifiers, see the following table.
Unified property model property | CM_DRP_Xxx value | SPDRP_Xxx value |
---|---|---|
DEVPKEY_Device_DeviceDesc | CM_DRP_DEVICEDESC | SPDRP_DEVICEDESC |
DEVPKEY_Device_HardwareIds | CM_DRP_HARDWAREID | SPDRP_HARDWAREID |
DEVPKEY_Device_CompatibleIds | CM_DRP_COMPATIBLEIDS | SPDRP_COMPATIBLEIDS |
DEVPKEY_Device_Service | CM_DRP_SERVICE | SPDRP_SERVICE |
DEVPKEY_Device_Class | CM_DRP_CLASS | SPDRP_CLASS |
DEVPKEY_Device_ClassGuid | CM_DRP_CLASSGUID | SPDRP_CLASSGUID |
DEVPKEY_Device_ConfigFlags | CM_DRP_CONFIGFLAGS | SPDRP_CONFIGFLAGS |
DEVPKEY_Device_Manufacturer | CM_DRP_MFG | SPDRP_MFG |
DEVPKEY_Device_FriendlyName | CM_DRP_FRIENDLYNAME | SPDRP_FRIENDLYNAME |
DEVPKEY_Device_LocationInfo | CM_DRP_LOCATION_INFORMATION | SPDRP_LOCATION_INFORMATION |
DEVPKEY_Device_PDOName | CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME | SPDRP_PHYSICAL_DEVICE_OBJECT_NAME |
DEVPKEY_Device_Capabilities | CM_DRP_CAPABILITIES | SPDRP_CAPABILITIES |
DEVPKEY_Device_UINumber | CM_DRP_UI_NUMBER | SPDRP_UI_NUMBER |
DEVPKEY_Device_BusTypeGuid | CM_DRP_BUSTYPEGUID | SPDRP_BUSTYPEGUID |
DEVPKEY_Device_LegacyBusType | CM_DRP_LEGACYBUSTYPE | SPDRP_LEGACYBUSTYPE |
DEVPKEY_Device_BusNumber | CM_DRP_BUSNUMBER | SPDRP_BUSNUMBER |
DEVPKEY_Device_EnumeratorName | CM_DRP_ENUMERATOR_NAME | SPDRP_ENUMERATOR_NAME |
DEVPKEY_Device_Security | CM_DRP_SECURITY | SPDRP_SECURITY |
DEVPKEY_Device_SecuritySDS | CM_DRP_SECURITY_SDS | SPDRP_SECURITY_SDS |
DEVPKEY_Device_DevType | CM_DRP_DEVTYPE | SPDRP_DEVTYPE |
DEVPKEY_Device_Exclusive | CM_DRP_EXCLUSIVE | SPDRP_EXCLUSIVE |
DEVPKEY_Device_Characteristics | CM_DRP_CHARACTERISTICS | SPDRP_CHARACTERISTICS |
DEVPKEY_Device_Address | CM_DRP_ADDRESS | SPDRP_ADDRESS |
For information about how to use property keys to access device instance properties in Windows Vista and later versions of Windows, see Accessing Device Instance Properties (Windows Vista and Later).
Accessing a Device Property
To access device instance properties that correspond to the CM_DRP_Xxx or SPDRP_Xxx identifiers on Windows Server 2003, Windows XP, and Windows 2000, use the following functions:
CM_Get_DevNode_Registry_Property or SetupDiGetDeviceRegistryProperty to retrieve a property.
CM_Set_DevNode_Registry_Property or SetupDiSetDeviceRegistryProperty to set a property.