🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11131

Re: CreateFile and ReadFile

#11131
From: Andrue Cope
Date: Mon, 23 Feb 2004 09:42
58 lines
4051 bytes
On Sun, 22 Feb 2004 21:34:59 +0800, ray wrote:

> about the  IOCTL_DISK_GET_DRIVE_GEOMETRY in the DeviceIoControl,
> 
> generally, this information is saved in the harddisrk or eprom?

Ah....tricky question. Disk geometry used to be important but these days
most devices and operating systems hide the details from the user or simply
make them up.

Some examples of the kind of trickery that goes on:

If you want to read from an IDE disk you can actually use SPTI (SCSI Pass
Through Interface). Blocks are read with a simple numeric rather than the
old Cylinder:Head:Sector notation. You can even issue simple SCSI commands
like Inquiry and Mode sense. Now obviously the operating system is faking a
SCSI response set for the IDE drive.

But..even under DOS you don't have to use CHS notation. The BIOS Int13
function provides block-by-block access. Is the BIOS faking it? Well no.
Modern drives themselves can be accessed block-by-block.

Suppose you use CHS - what does it mean? Well not a lot actually. The
physical geometry returned by a modern drive is usually incorrect if not
downright misleading. Modern drives don't have a fixed number of sectors
per track. The outermost tracks will have more sectors on them than the
innermost.

So where does a hard drive store the geometry? Usually in an EEPROM but it
can also be on engineering tracks on the platter. Some drives even boot
themselves off engineering tracks. Part of what we as a data recovery
company have to do is swap circuit boards and this can be a real problem.

We have a /huge/ stock of drives and that includes many different revisions
of the same model. This is because revisions to firmware and circuitry can
render swapping impossible. Another reason is because the circuit boards
learn particular characteristics of their HDA (such as head settle time and
seek latency) in order to compensate for manufacturing tolerances.

We have had occasions when we swap a board and the drive claims to be a
different capacity. Sometimes we have to order specific circuit board
revisions (there are quite a few retailers will do this though the cost is
a lot higher than buying new) and have had to ship drives from all over the
world. One notable example was a Fujitsu unit that was shipped from one of
their American offices because it was in a display case. It's that kind of
thing that makes D/R interesting and also proves the case for developing
good relationships with drive manufacturers :)

Now as for flash memory:Obviously CHS cannot apply and I don't personally
know if it returns a set of figures for that. If it does (and it might for
DOS compatibility) then I would guess they are hard coded into the
firmware.

So the basic answer to your question is:It can be stored anywhere. As long
as it's returned consistently you'd best not worry about it.
-- 
Andrue Cope
[Bicester UK]
Technical Details
Message-ID: <owhqmwxztmqk$.ihhbb8y2g2le$.dlg@40tude.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4034e792$1@newsgroups.borland.com> <ih67f05a4bzf.1w8m6acs1eu0e.dlg@40tude.net> <4034fbe4$1@newsgroups.borland.com> <7aeaoh9a6g9g.15gt18x45vjm.dlg@40tude.net> <40360608$1@newsgroups.borland.com> <l52qpbhp7lwy.1wdrj2fkltkg8$.dlg@40tude.net> <40363e6c$1@newsgroups.borland.com> <4038b004$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,a2e178d9fedcf99e
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-23 02:09:42 PST
From: Andrue Cope <no.spam@spammy.com>
Subject: Re: CreateFile and ReadFile
Newsgroups: borland.public.cppbuilder.nativeapi
User-Agent: 40tude_Dialog/2.0.10.1
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
References: <4034e792$1@newsgroups.borland.com> <ih67f05a4bzf.1w8m6acs1eu0e.dlg@40tude.net> <4034fbe4$1@newsgroups.borland.com> <7aeaoh9a6g9g.15gt18x45vjm.dlg@40tude.net> <40360608$1@newsgroups.borland.com> <l52qpbhp7lwy.1wdrj2fkltkg8$.dlg@40tude.net> <40363e6c$1@newsgroups.borland.com> <4038b004$1@newsgroups.borland.com>
Date: Mon, 23 Feb 2004 09:42:54 +0000
Message-ID: <owhqmwxztmqk$.ihhbb8y2g2le$.dlg@40tude.net>
NNTP-Posting-Host: 217.207.223.34
X-Trace: newsgroups.borland.com 1077529395 217.207.223.34 (23 Feb 2004 01:43:15 -0800)
Lines: 58
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail