| Previous | Next |
| ERROR_INVALID_QUOTA_LOWER | ERROR_INSTRUCTION_MISALIGNMENT |
ERROR_DEVICE_ALREADY_ATTACHED
A driver attempted to attach a device object that was already part of a stack
Function and filter drivers normally create an FDO or filter device object in AddDevice and attach it to the next lower device object with IoAttachDeviceToDeviceStack. The attachment establishes the I/O stack through which IRPs are passed. Reusing an already attached device object breaks that one-stack lifecycle and is not equivalent to creating another filter instance.
For driver debugging, inspect AddDevice error paths and re-entry assumptions. Each enumerated device instance should receive the correct per-device object and extension; global reuse of an FDO, duplicate attachment after partial initialization, or an attach path executed twice can produce this kind of state conflict. Keep the pointer returned by IoAttachDeviceToDeviceStack for forwarding and later detach the device during removal. The fix belongs in object ownership and PnP state management, not in retrying the attach call.
What to inspect
- Confirm one device object is created per intended stack instance.
- Audit AddDevice cleanup so a failed initialization cannot be attached again accidentally.
- Verify IoDetachDevice and IoDeleteDevice run during the matching remove path.
References
- Microsoft: AddDevice routines
- Microsoft: removing a device in a function driver
- Microsoft: PnP driver design guidelines
Looking for a different code? Search another status or error code.
