SwDevicePropertySet function (swdevice.h)

Sets properties on a software device.

Syntax

HRESULT SwDevicePropertySet(
  [in] HSWDEVICE         hSwDevice,
  [in] ULONG             cPropertyCount,
  [in] const DEVPROPERTY *pProperties
);

Parameters

[in] hSwDevice

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

[in] cPropertyCount

The number of DEVPROPERTY structures in the pProperties array.

[in] pProperties

An array of DEVPROPERTY structures containing the properties to set.

Return value

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

Remarks

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

You can call SwDevicePropertySet 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 SwDeviceCreate call and properties that are later set by calling SwDevicePropertySet. Properties that are set as part of SwDeviceCreate 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 SwDevicePropertySet after the enumeration don't persist in memory. But, if you set a property by using SwDeviceCreate, you can update the value with SwDevicePropertySet, and this update is applied to the in-memory value as well as the persisted store.

You can use SwDevicePropertySet only to set properties in the operating system store for the device.

Requirements

Requirement Value
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