writing to PhysicalDriveX

I have a requirement to do raw reads and writes to a physical drive at the
kernel level. I am opening a handle to the drives using ZwCreateFile by
passing in “\DosDevices\PhysicalDriveX” where “X” is “0”, “1”, etc. I can
successfully open and read a drive using this technigue, but my
ZwCreateFile call always fails when I attempt to open the drive for
writing. The error returned varies between “STATUS_INVALID_PARAMETER”,
“STATUS_ACCESS_DENIED”, and “STATUS_OBJECT_NAME_NOT_FOUND” depending on how
I have the parameters set. Has anyone tried this and can provide me with
the proper function syntax.

Thanks in advance,

Craig Denbrook
Sparta, Inc.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Craig,

you wrote on Saturday, February 16, 2002, 12:19:29:

cmsc> I have a requirement to do raw reads and writes to a physical
cmsc> drive at the kernel level. I am opening a handle to the drives
cmsc> using ZwCreateFile by passing in “\DosDevices\PhysicalDriveX”
cmsc> where “X” is “0”, “1”, etc. I can successfully open and read a
cmsc> drive using this technigue, but my ZwCreateFile call always fails
cmsc> when I attempt to open the drive for writing. The error returned
cmsc> varies between “STATUS_INVALID_PARAMETER”, “STATUS_ACCESS_DENIED”,
cmsc> and “STATUS_OBJECT_NAME_NOT_FOUND” depending on how I have the
cmsc> parameters set. Has anyone tried this and can provide me with the
cmsc> proper function syntax.

Make sure you have the sharing options set to
FILE_SHARE_READ|FILE_SHARE_WRITE.

Ralf.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com