SwDeviceGetLifetime function (swdevice.h)

Gets the lifetime of a software device.


HRESULT SwDeviceGetLifetime(
  [in] HSWDEVICE           hSwDevice,
  [in] PSW_DEVICE_LIFETIME pLifetime


[in] hSwDevice

The HSWDEVICE handle to the software device to retrieve.

[in] pLifetime

A pointer to a variable that receives a SW_DEVICE_LIFETIME-typed value that indicates the current lifetime value for the software device. Here are possible values:

Value Meaning
Indicates that the lifetime of the software device is determined by the lifetime of the handle that is associated with the software device. As long as the handle is open, the software device is enumerated by PnP.
Indicates that the lifetime of the software device is tied to the lifetime of its parent.

Return value

S_OK is returned if SwDeviceSetLifetime successfully retrieved the lifetime.


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