SetupDiSetDeviceRegistryPropertyA function (setupapi.h)
The SetupDiSetDeviceRegistryProperty function sets a Plug and Play device property for a device.
WINSETUPAPI BOOL SetupDiSetDeviceRegistryPropertyA( [in] HDEVINFO DeviceInfoSet, [in, out] PSP_DEVINFO_DATA DeviceInfoData, [in] DWORD Property, [in, optional] const BYTE *PropertyBuffer, [in] DWORD PropertyBufferSize );
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.
[in, out] DeviceInfoData
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.
One of the following values, which identifies the property to be set. For descriptions of these values, see SetupDiGetDeviceRegistryProperty.
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:
[in, optional] PropertyBuffer
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.
The size, in bytes, of PropertyBuffer. If PropertyBuffer is NULL, then this field must be zero.
The function returns TRUE if it is successful. Otherwise, it returns FALSE and the logged error can be retrieved with a call to GetLastError.
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.
The setupapi.h header defines SetupDiSetDeviceRegistryProperty as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Available in Microsoft Windows 2000 and later versions of Windows.|
|Header||setupapi.h (include Setupapi.h)|