| Previous | Next |
| STATUS_PORT_DISCONNECTED | STATUS_OBJECT_PATH_INVALID |
STATUS_DEVICE_ALREADY_ATTACHED
The device stack would contain a duplicate attachment
Function and filter device objects are layered over a physical device object to form one ordered stack. Attaching the same object twice, or reusing an attachment target after AddDevice has already completed, breaks stack traversal and reference assumptions. This status prevents that duplicate topology.
The fix is not to ignore the result and continue dispatching. Establish one owner for attachment, save the returned lower-device pointer, and detach only during the matching remove path. Re-enumeration can create a new device instance, so driver-global booleans are usually insufficient; lifecycle state belongs to the per-device extension or framework object.
What to inspect
- Log the source device object, target object and existing attached-device chain.
- Check AddDevice re-entry, failed initialization rollback and filter installation order.
- Keep attachment state per device instance and pair it with the corresponding detach and delete.
References
- Microsoft: Device objects and device stacks
- Microsoft: Introduction to Plug and Play
- Microsoft: Removing a device
- Microsoft Open Specifications: NTSTATUS values
- ReactOS source: PnP device action processing
Looking for a different code? Search another status or error code.