Hello,
I have a file system filter with PnP support. However, when the filter is
in place, the PnP device cannot be safely removed. It simply shows “The
device ***** cannot be stopped now. Try stopping the device again later
devices.”, while there is no problem when the filter is not in place.
I had a memory stick for test. It has the disk device obj like:
\Device\Harddisk2\DP(1)0-0+5, and FiDO disk device like:
\Device\Harddisk2\DR4. The driver stack is like this: my filter (if
installed)->PartMgr driver->\Device\Harddisk2\DR4(disk obj)->USBSTOR
device obj. By capturing the IRPs after issuing stop command from
“Hardware Safely Removal”, I found the following events:
- IRP_MN_QUERY_REMOVE_DEVICE to disk device (DP(1)0-0+5), completed from
this device. - IRP_MJ_CLEANUP to the disk device, completed from this device.
- IRP_MJ_CLOSE to the disk device, passed down to filter (with my
filter in place, that’s my filter, otherwise, PartMgr obj) till USBSTOR
obj. - IRP_MN_QUERY_DEVICE to FiDO disk device, i.e. \Device\Harddisk2\DR4,
pass down. However, there is no such operations with my filter in place. - IRP_MJ_CLEANUP to the FiDO disk device, similarly, no such op for my
filter. - IRP_MJ_CLOSE to the FiDO disk device, sa before, this only applies when
my filter is not in place. - IRP_MJ_CANCEL_REMOVE_DEVICE issued when my filter is in place, while
IRP_MN_REMOVE_DEVICE issued without my filter.
So step 4,5,6 is absent when my filter is in place. Looks like that might
cause problem. But what might be wrong in my filter to prevent PnP manager
from issuing these IRPs? Did I miss anything in my filter to handle PnP
requests?
Your help is greatly appreciated. Thanks in advance.
Yingping