SwDeviceInterfacePropertySet function

Sets properties on a software device interface.


HRESULT SwDeviceInterfacePropertySet(
  HSWDEVICE         hSwDevice,
  PCWSTR            pszDeviceInterfaceId,
  ULONG             cPropertyCount,
  const DEVPROPERTY *pProperties



The HSWDEVICE handle to the software device of the interface to set properties for.


A string that identifies the interface to set properties on.


The number of DEVPROPERTY structures in the pProperties array.


An array of DEVPROPERTY structures containing the properties to set on the interface.

Return value

S_OK is returned if SwDeviceInterfacePropertySet successfully set the properties on the interface; otherwise, an appropriate error value.


Typically, only the operating system and Administrators of the computer can set properties on an interface, but the creator of a device can call SwDeviceInterfacePropertySet to set properties on an interface for that device even if the creator isn't the operating system or an Administrator.

You can call SwDeviceInterfacePropertySet only after the operating system has called your client app's SW_DEVICE_CREATE_CALLBACK callback function to notify the client app that device enumeration completed.

There is a subtle difference between properties that are set as part of a SwDeviceInterfaceRegister call and properties that are later set by calling SwDeviceInterfacePropertySet. Properties that are set as part of SwDeviceInterfaceRegister are stored in memory; if the device is uninstalled or a null driver wipes out the property stores, these properties are written out again by the Software Device API feature when PnP re-enumerates the devices. This is all transparent to the client. Properties that are set using SwDeviceInterfacePropertySet after the enumeration don't persist in memory. But, if you set a property by using SwDeviceInterfaceRegister, you can update the value with SwDeviceInterfacePropertySet, and this update is applied to the in-memory value as well as the persisted store.

You can use SwDeviceInterfacePropertySet only to set properties in the operating system store for the interface.


Minimum supported client Windows 8
Minimum supported server Windows Server 2012
Target Platform Universal
Header swdevice.h
Library Swdevice.lib; OneCoreUAP.lib on Windows 10
DLL Cfgmgr32.dll