Board index » delphi » Reading disk surface contents - how?

Reading disk surface contents - how?

How is it possible to read/write anywhere on the hard disk surface?

Some programs, such as scandisk (chkdsk), can both read from and write to
the hard disk surface in order to verify that each byte of it can be written
to. Some programs can also "undelete" deleted files.

Which methods are used to read and write to the surface of a hard disk (or
any disk for that matter) and how can this be done in Delphi? Are these
functions available in the Windows API?

Lots of shouts!

 

Re:Reading disk surface contents - how?


On Fri, 10 Jan 2003 02:25:27 +0100, "Supply and Demand"

Quote
<tk...@tiscali.se> wrote:
>How is it possible to read/write anywhere on the hard disk surface?

>Some programs, such as scandisk (chkdsk), can both read from and write to
>the hard disk surface in order to verify that each byte of it can be written
>to. Some programs can also "undelete" deleted files.

>Which methods are used to read and write to the surface of a hard disk (or
>any disk for that matter) and how can this be done in Delphi? Are these
>functions available in the Windows API?

This depends on your Windows version.  In Win95, there are emulated
DOS interrupts that do it; in NT based versions, you just open the
device in a raw mode (using CreateFile with a special filename.) Both
can be done from Delphi, but it's a lot easier in NT.  See the Win32
help file.  The Win9x method is documented in some obscure place; I
forget where I saw it.

Be aware that you can pretty easily make a whole drive unreadable if
you write to it in the wrong place.

Duncan Murdoch

Re:Reading disk surface contents - how?


I'm using Windows XP... Does the "NT"-method apply to XP as well?

"Duncan Murdoch" <dmurd...@pair.com> skrev i meddelandet
news:ks8s1vod4ohne2ukpnfeseosnmm0p3dqnj@4ax.com...

Quote

> This depends on your Windows version.  In Win95, there are emulated
> DOS interrupts that do it; in NT based versions, you just open the
> device in a raw mode (using CreateFile with a special filename.) Both
> can be done from Delphi, but it's a lot easier in NT.  See the Win32
> help file.  The Win9x method is documented in some obscure place; I
> forget where I saw it.

> Be aware that you can pretty easily make a whole drive unreadable if
> you write to it in the wrong place.

> Duncan Murdoch

Re:Reading disk surface contents - how?


On Thu, 09 Jan 2003 20:41:20 -0500, Duncan Murdoch <dmurd...@pair.com>
wrote:

Quote
>On Fri, 10 Jan 2003 02:25:27 +0100, "Supply and Demand"
><tk...@tiscali.se> wrote:

>>How is it possible to read/write anywhere on the hard disk surface?

>>Some programs, such as scandisk (chkdsk), can both read from and write to
>>the hard disk surface in order to verify that each byte of it can be written
>>to. Some programs can also "undelete" deleted files.

>>Which methods are used to read and write to the surface of a hard disk (or
>>any disk for that matter) and how can this be done in Delphi? Are these
>>functions available in the Windows API?

>This depends on your Windows version.  In Win95, there are emulated
>DOS interrupts that do it; in NT based versions, you just open the
>device in a raw mode (using CreateFile with a special filename.) Both
>can be done from Delphi, but it's a lot easier in NT.  See the Win32
>help file.  The Win9x method is documented in some obscure place; I
>forget where I saw it.

An understanding of the file system helps, too <g>

--
jc

Re:Reading disk surface contents - how?


On Fri, 10 Jan 2003 10:09:15 +0100, "Supply and Demand"

Quote
<tk...@tiscali.se> wrote:
>I'm using Windows XP... Does the "NT"-method apply to XP as well?

Yes, Win2K, and XP are versions of NT.

The other thing you need to worry about is what Jeremy mentioned:  you
need to understand the file system.  If it's a FAT system, it's well
documented.  FAT32 is almost well documented.  I think Microsoft
treats NTFS as proprietary, and doesn't document it at all; last I
looked (a few years ago) the 3rd party documentation was really
incomplete.

Duncan Murdoch

Other Threads