Question for disk sector-level I/O operations?

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

Hi,all : p
I have encountered a question that how to read from/write to disk sector
directly by programme? Any reply is aprreciated :-p

Thanx very...much :D

--
Frank F.Han

+-----------------------------------------+
| winsays@:-)hotmail:-).com |
+-----------------------------------------+
 
Hi, Joep

Thanx for ur reply :-)
But I really dont know where it is, would u mind give more klew, please? I
very appreciate u :-|

Frank
 
Hi, Joep - and Frank.

That URL wrapped and led to a dead-end for me. Try this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/createfile.asp

This page says:
"CreateFile
"The CreateFile function creates or opens a file, directory, physical disk,
volume, console buffer, tape drive, communications resource, mailslot, or
named pipe. The function returns a handle that can be used to access the
object."

I hope that's the one Frank needs.

RC
 
R. C. White said:
Hi, Joep - and Frank.

That URL wrapped and led to a dead-end for me. Try this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base
/createfile.asp

This page says:
"CreateFile
"The CreateFile function creates or opens a file, directory, physical disk,
volume, console buffer, tape drive, communications resource, mailslot, or
named pipe. The function returns a handle that can be used to access the
object."

I hope that's the one Frank needs.

Yep, thank you! That's how to do it (opeing physical disks/volumes) in
Windows. Basically you can treat entire disks and partitions as if they were
files. In DOS use BIOS interupts (int13hx).

regards,
Joep
 
Frank said:
Hi,all : p
I have encountered a question that how to read from/write to disk sector
directly by programme? Any reply is aprreciated :-p

Just to make it a bit clearer, since it can take a few readings to
understand the subtleties in the article referenced in other replies, you
open a handle to C: or \\.\PhysicalDriveN, where N is an integer. Then you
have to use offset and length that is integer multiple of sector size.

This only applies to NT derivatives, and you need admin privilege to do it.

Phil
--
Philip D. Barila Windows DDK MVP
Seagate Technology, LLC
(720) 684-1842
As if I need to say it: Not speaking for Seagate.
E-mail address is pointed at a domain squatter. Use reply-to instead.
 
hi,phil

I have another question for using CreateFile(...).

For instance: If I use CreateFile() open d: drive, could I access the sector
include information of file system (fat/ntfs)?

very thanx :-p
Frank
 
Frank said:
hi,phil

I have another question for using CreateFile(...).

For instance: If I use CreateFile() open d: drive, could I access the sector
include information of file system (fat/ntfs)?

You can read the sectors containing FS data. You'll have to sort out the
meaning of the data you get back. What do you really want to do?

Phil
--
Philip D. Barila Windows DDK MVP
Seagate Technology, LLC
(720) 684-1842
As if I need to say it: Not speaking for Seagate.
E-mail address is pointed at a domain squatter. Use reply-to instead.
 
Back
Top