SetupDiSetDeviceRegistryProperty

BOOLEAN
SetupDiSetDeviceRegistryProperty(
IN HDEVINFO DeviceInfoSet,
IN OUT PSP_DEVINFO_DATA DeviceInfoData,
IN DWORD Property,
IN PBYTE PropertyBuffer,
IN DWORD PropertyBufferSize
);

SetupDiSetDeviceRegistryProperty sets the specified Plug and Play device registry property.

Parameters

DeviceInfoSet

Supplies a handle to the device information set containing information about the device instance whose Plug and Play registry property is to be modified.

DeviceInfoData

Supplies a pointer to an SP_DEVINFO_DATA structure indicating the device instance whose Plug and Play registry property is to be modified. If the ClassGUID property is being set, this structure is updated upon return to reflect the device's new class.

Property

Supplies an ordinal specifying the property to be set. Can be one of the following values:

Code Property
SPDRP_DEVICEDESC (0x00) DeviceDesc
SPDRP_HARDWAREID (0x01) HardwareID
SPDRP_COMPATIBLEIDS (0x02) CompatibleIDs
SPDRP_SERVICE (0x04) Service
SPDRP_CLASSGUID (0x08) ClassGUID
SPDRP_DRIVER (0x09) Driver
SPDRP_CONFIGFLAGS (0x0A) ConfigFlags
SPDRP_MFG (0x0B) Mfg
SPDRP_FRIENDLYNAME (0x0C) FriendlyName

PropertyBuffer

Buffer that contains the new data for the property.

PropertyBufferSize

Supplies the size, in bytes, of PropertyBuffer.

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.

Comments

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.

See Also

SetupDiGetDeviceRegistryProperty