Sets properties on a software device.
HRESULT SwDevicePropertySet( HSWDEVICE hSwDevice, ULONG cPropertyCount, const DEVPROPERTY *pProperties );
The HSWDEVICE handle to the software device to set properties for.
The number of DEVPROPERTY structures in the pProperties array.
An array of DEVPROPERTY structures containing the properties to set.
S_OK is returned if SwDevicePropertySet successfully set the properties; otherwise, an appropriate error value.
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.
|Minimum supported client||Windows 8|
|Minimum supported server||Windows Server 2012|
|Library||Swdevice.lib; OneCoreUAP.lib on Windows 10|