SetupDiSetDeviceInterfaceProperty function

The SetupDiSetDeviceInterfaceProperty function sets a device property of a device interface.


BOOL SetupDiSetDeviceInterfaceProperty(
  _In_           HDEVINFO                  DeviceInfoSet,
  _In_           PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
  _In_     const DEVPROPKEY                *PropertyKey,
  _In_           DEVPROPTYPE               PropertyType,
  _In_opt_ const PBYTE                     PropertyBuffer,
  _In_           DWORD                     PropertyBufferSize,
  _In_           DWORD                     Flags


DeviceInfoSet [in]

A handle to a device information set that contains the device interface for which to set a device interface property.

DeviceInterfaceData [in]

A pointer to an SP_DEVICE_INTERFACE_DATA structure that represents the device interface for which to set a device interface property.

PropertyKey [in]

A pointer to a DEVPROPKEY structure that represents the device property key of the device interface property to set.

PropertyType [in]

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.

PropertyBuffer [in, optional]

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.

PropertyBufferSize [in]

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.

Flags [in]

Must be set to zero.

Return value

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.

Return codeDescription

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.


Target platform

For universal, call CM_Set_Device_Interface_Property


Available in Windows Vista and later versions of Windows.


Setupapi.h (include Setupapi.h)



See also




Send comments about this topic to Microsoft