SetupDiSetDeviceRegistryPropertyA function

The SetupDiSetDeviceRegistryProperty function sets a Plug and Play device property for a device.

Syntax

WINSETUPAPI BOOL SetupDiSetDeviceRegistryPropertyA(
  HDEVINFO         DeviceInfoSet,
  PSP_DEVINFO_DATA DeviceInfoData,
  DWORD            Property,
  CONST BYTE       *PropertyBuffer,
  DWORD            PropertyBufferSize
);

Parameters

DeviceInfoSet

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

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

One of the following values, which identifies the property to be set. For descriptions of these values, see SetupDiGetDeviceRegistryProperty.

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:

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.

PropertyBufferSize

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

   
Windows version Available in Microsoft Windows 2000 and later versions of Windows.
Target Platform Desktop
Header setupapi.h (include Setupapi.h)
Library Setupapi.lib

See Also

SetupDiGetClassRegistryProperty

SetupDiGetDeviceRegistryProperty

SetupDiSetClassRegistryProperty