How to do a "force dismount" ?

Hi,

I wrote a disk emulator driver - for some cryptographic purposes
and I have a big problem with dismounting it.

More precisely, I would like to do a “force dismount”, so in my code I’m
doing:
hDrive = CreateFile( “\\.\Z:”, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL );

DeviceIoControl(
hDrive,
FSCTL_DISMOUNT_VOLUME,
NULL,
0,
NULL,
0,
&nread,
NULL
); // passes OK

DeviceIoControl(
hDrive,
IOCTL_CRYPTODISK_CLOSE_MEDIA,
NULL,
0,
NULL,
0,
&nread,
NULL
); // reports error

The last DeviceIoControl function reports an error which is 0x15. That means
ERROR_NOT_READY. Does anybody have an idea about that ? I’ve noticed, that
my driver’s DeviceControl function is not called.

Any help would be appreciated.

Regards,
Marcin

Hi,

There is a knowledge base article that covers this:
http://support.microsoft.com/support/kb/articles/Q165/7/21.asp

Also, take a look at Bo Branten’s implementation of a virtual disk
driver that supports dismounting: http://www.acc.umu.se/~bosse/


Bartjan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Marcin
Toczydlowski
Sent: maandag 18 maart 2002 15:25
To: File Systems Developers
Subject: [ntfsd] How to do a “force dismount” ?

Hi,

I wrote a disk emulator driver - for some cryptographic
purposes and I have a big problem with dismounting it.

More precisely, I would like to do a “force dismount”, so in
my code I’m
doing:
hDrive = CreateFile( “\\.\Z:”, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL );

DeviceIoControl(
hDrive,
FSCTL_DISMOUNT_VOLUME,
NULL,
0,
NULL,
0,
&nread,
NULL
); // passes OK

DeviceIoControl(
hDrive,
IOCTL_CRYPTODISK_CLOSE_MEDIA,
NULL,
0,
NULL,
0,
&nread,
NULL
); // reports error

The last DeviceIoControl function reports an error which is
0x15. That means ERROR_NOT_READY. Does anybody have an idea
about that ? I’ve noticed, that my driver’s DeviceControl
function is not called.

Any help would be appreciated.

Regards,
Marcin


You are currently subscribed to ntfsd as: xxxxx@zeelandnet.nl
To unsubscribe send a blank email to %%email.unsub%%