- raw write access in vista
- Posted by Nidhi Malik on September 28th, 2007
Hi all,
I need raw write access to drive ( to write on sectors) for my utility. But
vista return ACCESS_DENIED to WriteFile().
according to msdn documentation the following changes have been made in
Windows Vista and later:
A write on a volume handle will succeed if the volume is not mounted by a
file system, or if one of the following conditions is true:
1. The sectors to be written to are boot sectors.
2. The sectors to be written to reside outside of file system space.
3. You have explicitly locked or dismounted the volume by using
FSCTL_LOCK_VOLUME or FSCTL_DISMOUNT_VOLUME.
4 . The volume has no file system. (In other words, it has been mounted
as a RAW volume.)
A write on a disk handle will succeed if one of the following conditions
is true:
1. The sectors to be written to do not fall within a volume's extents.
2. The sectors to be written to fall within a mounted volume, but you
have explicitly locked or dismounted the volume by using FSCTL_LOCK_VOLUME
or FSCTL_DISMOUNT_VOLUME.
3. The sectors to be written to fall within a volume that is not mounted
or has no file system.
The modification of some disk parts, like the boot sector ( upto 16 ), is
still allowed . But my utility relies on raw write access to the disk. I am
not able to lock volume by FSCTL_LOCK_VOLUME. Result is ACCESS DENIED. While
searching through net i come to know that kernel mode driver is only
solution. But in this group i come to know driver is not require. I work on
services and pass through SCSI, but i am not able to find the solution. If
kernel mode driver is require then what kind of driver it should be ?
Is anybody know the solution of the problem then please help me out
Waiting for solutions
Nidhi
- Posted by Don Burn on September 28th, 2007
The solution is for you to take a good system programming class. You have
been asking this question on various forums for over 2 months, you have
recieved multiple answers on how to do this. No, we are not going to write
the code for you.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
"Nidhi Malik" <nidhi.malik@stellarinfo.com> wrote in message
news:%23jgwjPbAIHA.4444@TK2MSFTNGP03.phx.gbl...
- Posted by vs on September 29th, 2007
Nidhi
Please post your code snippet you wrote to unmount the volume. If you
need code for the driver I can send you some.
vs
Don Burn wrote:
- Posted by gerg on November 24th, 2007
On Sep 28, 1:42 am, "Nidhi Malik" <nidhi.ma...@stellarinfo.com> wrote:
lock volume is probably failing because there are open handles to the
volume. you can still dismount but it is not safe/desirable. the
standard thing to do in this case is to prompt the user if they wish
to force dismount.