Unexpected STATUS_SHARING_VIOLATION in IoAttachDevice

Hi there,

I am developing a small filter for mouse driver, which facilitates dynamic resolution changing and some other features similar to those present in, for instance, Logitech gaming mice. I wrote my simple driver, tested it under VmWare Workstation, Win XP/I386/SP2. Worked well. Unfortunately, under any regular environment it does not work, i.e. it fails on IoAttachDevice, where I get STATUS_SHARING_VIOLATION. I spent some time with google and came out with an answer ‘why’ (I cant get a handle to the device, because something holds this exclusively), but without any hints how to bypass this problem. I would like this tool to be freely distributed, so the solution should also be rather portable. Any hints would be very much appreciated.

cheers,
Lukasz Rewerenda

p.s. I do hope this does not get posted twice, but I posted this once 4 hours ago and I still dont see it on the board.