Setting Device Object Registry Properties After Installation
A user-mode program can use the device installation functions to get or set the registry settings for the properties of a driver's device object. Normally these functions are used by installation software, but they can be used by any user-mode program. (The program must be executed by a user that has Administrator access.)
The SetupDiGetDeviceRegistryProperty and SetupDiSetDeviceRegistryProperty functions get and set the registry key for each specified property. The Property parameter specifies the property to get or set. The PropertyBuffer points to the destination buffer (when getting the property) or source buffer (when setting the property) for the property.
The correspondence between values for the Property parameter and actual properties is as follows.
Value for Property parameter | Device object property |
---|---|
SPDRP_CHARACTERISTICS |
Device characteristics |
SPDRP_DEVTYPE |
Device type |
SPDRP_EXCLUSIVE |
Exclusive |
SPDRP_SECURITY |
Security descriptor as a SECURITY_DESCRIPTOR structure |
SPDRP_SECURITY_SDS |
Security descriptor as an SDDL string |
Note that two different ways are provided to get or set the security descriptor. You can specify the SPDRP_SECURITY value to treat the security descriptor as a SECURITY_DESCRIPTOR structure, or SPDRP_SECURITY_SDS to treat the security descriptor as an SDDL string. For more information about SDDL strings, see SDDL for Device Objects.
For Windows XP and later operating systems, programs can also get and set the property values for a device setup class. Use the SetupDiGetClassRegistryProperty and SetupDiSetClassRegistryProperty functions to get and set the property values for a device setup class.
For more information about using the SetupDiXxx functions, see Using Device Installation Functions.