WDM mouse driver problem (with corrections)

Hello guys,
I’ve written WDM mouse filter driver for Windows2000 using Crt2Cap as
prototype. Additionaly I’ve implemented putting “mousestrokes” in as though
the mouse as been moved. I used technique described a lot of times in news
and in MS’ sample JOYFLT - I am just pending the IRP_MJ_READ that comes from
USER, then I create my own Irp (IRP_MJ_READ) to pass it to lower driver and
so on.
Everything works fine. I can dynamicaly attach additional USB mouses in
system and filter driver works correctly with multiple mouses. The
difficulty appears when I dynamicaly detach USB mouse at once after my
IRP_MN_SURPRISE_REMOVAL handler - I have such an impression that system is
deadlocked somehow, because it does not react on mouse, keyboard and so
on…
In debugger I tracked that deadlock occures in IopNotifyTargetDeviceChange
routine.
What’s wrong. What should I do to avoid this problem?
Thanks.

Bye,
Sab


Bye,
Sab