The SetupDiSetDeviceInterfaceProperty function sets a device property of a device interface.
WINSETUPAPI BOOL SetupDiSetDeviceInterfacePropertyW( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, CONST DEVPROPKEY *PropertyKey, DEVPROPTYPE PropertyType, CONST PBYTE PropertyBuffer, DWORD PropertyBufferSize, DWORD Flags );
A handle to a device information set that contains the device interface for which to set a device interface property.
A pointer to an SP_DEVICE_INTERFACE_DATA structure that represents the device interface for which to set a device interface property.
A pointer to a DEVPROPKEY structure that represents the device property key of the device interface property to set.
A DEVPROPTYPE-typed value that represents the property-data-type identifier of the device interface property to set. For more information about the property-data-type identifier, see the Remarks section later in this topic.
A pointer to a buffer that contains the device interface property value. If either the property or the interface value is being deleted, this pointer must be set to NULL, and PropertyBufferSize must be set to zero. For more information about property value data, 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.
Must be set to zero.
SetupDiSetDeviceInterfaceProperty returns TRUE if it is successful. Otherwise, this function 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 not zero.|
||The device information set that is specified by DevInfoSet is not valid.|
||A supplied parameter is not valid. One possibility is that the device interface specified by DeviceInterfaceData is not valid.|
||The property key that is supplied by PropertyKey is not valid.|
||An unspecified data value was not valid. This error could be logged if either the symbolic link name of the device interface is not valid or the property-data-type identifier is not valid.|
||A user buffer is not valid. One possibility is that PropertyBuffer is NULL, and PropertBufferSize is not zero.|
||The device interface that is specified by DeviceInterfaceData does not exist.|
||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 internal element was not found. One possibility is that a property to be deleted does not exist.|
||The caller does not have Administrator privileges.|
SetupDiSetDeviceInterfaceProperty is part of the unified device property model.
SetupAPI supports only a Unicode version of SetupDiSetDeviceInterfaceProperty.
A caller of SetupDiSetDeviceInterfaceProperty must be a member of the Administrators group to set a device interface property.
SetupDiSetDeviceInterfaceProperty 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 interface, call SetupDiGetDeviceInterfacePropertyKeys.
To retrieve a device interface property, call SetupDiGetDeviceInterfaceProperty.
|Windows version||Available in Windows Vista and later versions of Windows.|
|Target Platform||DesktopFor universal, call CM_Set_Device_Interface_Property|
|Header||setupapi.h (include Setupapi.h)|