This is a side affect of not unregistering your device interface during surprise removal. If you do not unregister during surprise removal, this can happen:
- Instance #1 is built up and start and registers the device interface
- Instance #1 gets surprise removed, does not unregister the device interface, and stays in the surprise removed state.
- Instance #2 is built up (it has the same device instance path as Instance #1) and started and registers the device interface.
- Instance #1 moves into the removed state and it unregisters the device interface in its remove IRP handler for the surprsise removed -> removed state transition. (For the graceful remove transition, e.g. query removed -> removed transition, the remove handler should unregister the device interface).
When the last step occurs, both instance #1 and #2 have the same device interface string, so when instance #1 unregisters its interface it inadvertantly affects the state of instance #2’s device interface.