Accessing device properties
You must not discover or change device properties by directly accessing registry keys. Registry keys do not contain required information to discover or change device properties. In addition, the location, format, and meaning of these keys might change between different versions of Windows.
The SetupAPI and configuration manager functions provide consistent behavior and enforce access permissions to protect device properties. To safely access device properties, follow these guidelines:
For user-mode applications, follow these steps:
For information about accessing device instance properties on Windows Vista and later versions of Windows, see Accessing Device Instance Properties (Windows Vista and Later).
Starting with Windows Vista, some device properties are reserved by the operating system. For more information, see Rules for Modifying Device Properties.
For information about accessing device instance properties on Windows 2000, Windows XP, and Windows Server 2003, see Using SetupAPI and Configuration Manager to Access Device Properties.
For kernel-mode drivers, follow these steps:
On Windows Vista and later versions of Windows, use IoGetDevicePropertyData and IoSetDevicePropertyData to access device properties.
On Windows 2000, Windows XP, and Windows Server 2003, use IoGetDeviceProperty to access device properties.