SetupDiSetDeviceRegistryProperty function
The SetupDiSetDeviceRegistryProperty function sets a Plug and Play device property for a device.
Syntax
BOOL SetupDiSetDeviceRegistryProperty(
_In_ HDEVINFO DeviceInfoSet,
_Inout_ PSP_DEVINFO_DATA DeviceInfoData,
_In_ DWORD Property,
_In_opt_ const BYTE *PropertyBuffer,
_In_ DWORD PropertyBufferSize
);
Parameters
- DeviceInfoSet [in]
-
A handle to the device information set that contains a device information element that represents the device for which to set a Plug and Play device property.
- DeviceInfoData [in, out]
-
A pointer to an SP_DEVINFO_DATA structure that specifies the device information element in DeviceInfoSet. If the ClassGuid property is set, DeviceInfoData.ClassGuid is set upon return to the new class for the device.
- Property [in]
-
One of the following values, which identifies the property to be set. For descriptions of these values, see SetupDiGetDeviceRegistryProperty.
- SPDRP_CONFIGFLAGS
- SPDRP_EXCLUSIVE
- SPDRP_FRIENDLYNAME
- SPDRP_LOCATION_INFORMATION
- SPDRP_LOWERFILTERS
- SPDRP_REMOVAL_POLICY_OVERRIDE (Windows XP and later)
- SPDRP_SECURITY
- SPDRP_SECURITY_SDS
- SPDRP_UI_NUMBER_DESC_FORMAT
- SPDRP_UPPERFILTERS
Note SPDRP_HARDWAREID or SPDRP_COMPATIBLEIDS can only be used when DeviceInfoData represents a root-enumerated device. For other devices, the bus driver reports hardware and compatible IDs when enumerating a child device after receiving IRP_MN_QUERY_ID.The following values are reserved for use by the operating system and cannot be used in the Property parameter:
- SPDRP_ADDRESS
- SPDRP_BUSNUMBER
- SPDRP_BUSTYPEGUID
- SPDRP_CHARACTERISTICS
- SPDRP_CAPABILITIES
- SPDRP_CLASS
- SPDRP_CLASSGUID
- SPDRP_DEVICE_POWER_DATA
- SPDRP_DEVICEDESC
- SPDRP_DEVTYPE
- SPDRP_DRIVER
- SPDRP_ENUMERATOR_NAME
- SPDRP_INSTALL_STATE (Windows XP and later)
- SPDRP_LEGACYBUSTYPE
- SPDRP_LOCATION_PATHS (Windows Server 2003 and later)
- SPDRP_MFG
- SPDRP_PHYSICAL_DEVICE_OBJECT_NAME
- SPDRP_REMOVAL_POLICY
- SPDRP_REMOVAL_POLICY_HW_DEFAULT
- SPDRP_SERVICE
- SPDRP_UI_NUMBER
- PropertyBuffer [in, optional]
-
A pointer to a buffer that contains the new data for the property. If the property is being cleared, then this pointer should be NULL and PropertyBufferSize must be zero.
- PropertyBufferSize [in]
-
The size, in bytes, of PropertyBuffer. If PropertyBuffer is NULL, then this field must be zero.
Return value
The function returns TRUE if it is successful. Otherwise, it returns FALSE and the logged error can be retrieved with a call to GetLastError.
Remarks
The caller of this function must be a member of the Administrators group.
The class name property cannot be set because it is based on the corresponding class GUID and is automatically updated when that property is changed. When the ClassGUID property changes, SetupDiSetDeviceRegistryProperty automatically cleans up any software keys associated with the device.
Requirements
|
Target platform |
|
|---|---|
|
Version |
Available in Microsoft Windows 2000 and later versions of Windows. |
|
Header |
|
|
Library |
|
See also