Hi experts,
I’m trying to get VDO to be dismounted in
IRP_MJ_FILE_SYSTEM_CONTROL/IRP_MN_USER_FS_REQUEST with FSCTL_DISMOUNT_VOLUME
control code. What parameters in IRP are used with this control code isn’t
documented in DDK/IFS. Particularly I need VDO to be dismounted.
I’ve successfully attached to file system CDO and I get mount call. I’m
testing with USB stick to see if my code works in a dynamic condition. I
provide the handler for the above IRP Major/Minor and control code. But that
control code doesn’t arrive when I remove USB stick whereas I DO get
IRP_MN_MOUNT_VOLUME when USB stick is inserted.
Basically I have to detect volume dismount and do my own processing. For my
own purpose I’m not attaching to the file system VDOs. I’m just attaching to
file systems’ CDOs. I would get dismount notification in FastIoDetachDevice
if I had provided the filter devices for FS VDOs, but currently I want to
avoid that.
Does any one know what I’m doing wrong or shed some light on dismount
detection?
I looked at IoRegisterPlugPlayNotification(), but it doesn’t seem to be what
I want let alone I don’t have enough parameters available required by that
function.
Thanks as always,
Regards,
Sean
A short test with FileSPy would reveal that you will get
IRP_MJ_PNP/IRP_MN_SURPRISE_DEMOVAL.
followed by FASTIO_DETACH_DEVICE
If you eject the USB volume using correct way “Eject
from systray”, you’ll get IPR_MJ_PNP/IRP_MN_QUERY_REMOVE_DEVICE
followed by FASTIO_DETACH_DEVICE (if successful)
So FASTIO_DETACH_DEVICE is what do you need to watch.
L.
> Basically I have to detect volume dismount and do my own processing. For my
The correct way is:
- open the handle
- FSCTL_LOCK_VOLUME (can fail if somebody else have open files)
- FSCTL_DISMOUNT_VOLUME
- do your work via this very handle
- FSCTL_UNLOCK_VOLUME
- close the handle
This is how FORMAT and CHKDSK /F work.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
I appreciate your analysis, Ladislav.
However FASTIO_DETACH_DEVICE is called back only when you have a VDO
filter devices attached to the stack, which I want to avoid. I’ve got
only CDO filter devices attached to the stack.
Thanks.
Regards,
Sean
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ladislav Zezula
Sent: Tuesday, 29 November 2005 6:31 PM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] How can I get VDO to be dismounted in
IRP_MN_USER_FS_REQUEST with FSCTL_DISMOUNT_VOLUME?
A short test with FileSPy would reveal that you will get
IRP_MJ_PNP/IRP_MN_SURPRISE_DEMOVAL.
followed by FASTIO_DETACH_DEVICE
If you eject the USB volume using correct way “Eject
from systray”, you’ll get IPR_MJ_PNP/IRP_MN_QUERY_REMOVE_DEVICE
followed by FASTIO_DETACH_DEVICE (if successful)
So FASTIO_DETACH_DEVICE is what do you need to watch.
L.
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@pctools.com
To unsubscribe send a blank email to xxxxx@lists.osr.com