| Previous | Next |
| SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE | SPAPI_E_DEVICE_INTERFACE_REMOVED |
SPAPI_E_DEVICE_INTERFACE_ACTIVE
Registration removal requires the interface to be inactive
SPAPI_E_DEVICE_INTERFACE_ACTIVE commonly appears when SetupDiRemoveDeviceInterface is called for an enabled interface. Device-interface registration and device operational state are related but distinct: removing the registration while clients can still discover or open it would violate the interface lifecycle.
Closing an application handle alone may not deactivate the interface. The driver or Plug and Play operation must disable or stop the underlying device/interface through the supported state-change path before SetupAPI can remove the registration.
Perform teardown in lifecycle order
- Inspect the SPINT_ACTIVE flag in the interface data.
- Stop new opens and close outstanding device handles.
- Disable or stop the underlying device through the appropriate PnP mechanism.
- Remove the interface registration only after SetupAPI reports it inactive.
References
- Microsoft: SetupDiRemoveDeviceInterface
- Microsoft: SP_DEVICE_INTERFACE_DATA flags
- Microsoft: enabling and disabling device interfaces
Looking for a different code? Search another status or error code.