SetupDiSetClassPropertyExW function (setupapi.h)
WINSETUPAPI BOOL SetupDiSetClassPropertyExW( [in] const GUID *ClassGuid, [in] const DEVPROPKEY *PropertyKey, [in] DEVPROPTYPE PropertyType, [in, optional] const PBYTE PropertyBuffer, [in] DWORD PropertyBufferSize, [in] DWORD Flags, [in, optional] PCWSTR MachineName, PVOID Reserved );
A pointer to a GUID that identifies the device setup class or device interface class for which to set a device property. For information about how to specify the class type, see the Flags parameter.
A pointer to a DEVPROPKEY structure that represents the device property key of the device class property to set.
A DEVPROPTYPE-typed value that represents the property-data-type identifier for the class property. For more information about the property-data-type identifier, see the Remarks section later in this topic.
[in, optional] PropertyBuffer
A pointer to a buffer that contains the class property value. If either the property or the property value is being deleted, this pointer must be set to NULL, and PropertyBufferSize must be set to zero. For more information about property value requirements, see the Remarks section later in this topic.
The size, in bytes, of the PropertyBuffer buffer. The property buffer size must be consistent with the property-data-type identifier that is supplied by PropertyType. If PropertyBuffer is set to NULL, PropertyBufferSize must be set to zero.
One of the following values, which specifies whether the class is a device setup class or a device interface class:
ClassGuid specifies a device setup class. This flag cannot be used with DICLASSPROP_INTERFACE.
ClassGuid specifies a device interface class. This flag cannot be used with DICLASSPROP_INSTALLER.
[in, optional] MachineName
A pointer to a NULL-terminated Unicode string that contains the UNC name, including the "\" prefix, of a computer. This pointer can be set to NULL. If the pointer is NULL, SetupDiSetClassPropertyEx sets the class property for a class that is installed on the local computer.
This parameter must be set to NULL.
SetupDiSetClassPropertyEx returns TRUE if it is successful. Otherwise, it returns FALSE, and the logged error can be retrieved by calling GetLastError.
The following table includes some of the more common error codes that this function might log.
||The value of Flags is invalid.|
||The device setup class that is specified by ClassGuid is not valid. This error can occur only if the DICLASSPROP_INSTALLER flag is specified.|
||The device interface reference string is not valid. This error can occur only if the DICLASSPROP_INTERFACE flag is specified.|
||The property key that is supplied by PropertyKey is not valid.|
||An unspecified internal data value was not valid. This error could be logged if either the ClassGuid value is not a valid GUID or the property value does not match the property type specified by PropertyType.|
||A user buffer is not valid. One possibility is that PropertyBuffer is NULL, and PropertyBufferSize is not zero.|
||The computer name that is specified by MachineName is not valid.|
||The device interface class that is specified by ClassGuid does not exist. This error can occur only if the DICLASSPROP_INTERFACE flag is specified.|
||An internal data buffer that was passed to a system call was too small.|
||There was not enough system memory available to complete the operation.|
||An unspecified item was not found. One possibility is that the property to be deleted does not exist.|
||The caller does not have Administrator privileges.|
SetupDiSetClassPropertyEx is part of the unified device property model.
SetupAPI supports only a Unicode version of SetupDiSetClassPropertyEx.
A caller of SetupDiSetClassPropertyEx must be a member of the Administrators group to set a device interface property.
SetupDiSetClassPropertyEx enforces requirements on the property-data-type identifier and the property value.
To obtain the device property keys that represent the device properties that are set for a device class on a remote computer, call SetupDiGetClassPropertyKeysEx.
To set a device class property on a local computer, call SetupDiSetClassProperty.
|Minimum supported client||Available in Windows Vista and later versions of Windows.|
|Header||setupapi.h (include Setupapi.h)|