a1200   NEWS   APPS   DOCS   ABOUT
a1200
----
a1200
----
Autodocs
 Libraries:
 hdwrench.library
  FindControllerID
  FindDefaults
  FindDiskName
  FindLastSector
  HDWCloseDevice
  HDWOpenDevice
  InMemMountfile
  InMemRDBStructs
  LowlevelFormat
  OutMemMountfile
  OutMemRDBStructs
  QueryCapacity
  QueryFindValid
  QueryInquiry
  QueryModeSense
  QueryReady
  RawRead
  RawWrite
  ReadMountfile
  ReadRDBStructs
  ReadRDBs
  VerifyDrive
  WriteBlock
  WriteMountfile
  WriteRDBStructs
  WriteRDBs
  ZZexample
  description
Include
GuruMeditation
Docs » Autodocs » hdwrench.library » FindLastSector

NAME

    FindLastSector

SYNOPSIS

    result = FindLastSector ( void )
D0
ULONG FindLastSector ( void )

FUNCTION

    Determine the last useable sector on the disk. If this value differs
materially from a ReadCapacity return value consider that the drive
should be formatted before use. This function performs a binary search
for the highest readable block starting at the block returned by the
ReadCapacity command. (Every once and awhile you will find a drive that
was not formatted completely escaping the drive manufacturers. This
function will discover this and other interesting effects such as off
by one errors.)

INPUTS

    none

RESULT

    result  ULONG 0 on failure otherwise the value of the highest readable
block on the drive PLUS 1.

NOTES

    This command requires the library have a device open to proceed.

BUGS

    This is NOT a test for bad blocks. If it hits a bad block in its test
near the end of the drive it may get confused. I am unable to test this
condition. If the emulated SCSI device for an IDE drive does not
correctly report a read failure on attempting to read the disk outside
the address range possible this command could loop to ridiculous values.
Code to hopefully prevent this exists but is untested.

SEE ALSO

hdwrench.library/ReadCapacity

Comments

Name:
E-mail: Use this if you want a message if you get a response, will not be shown.
Comment:
Select correct short for:

Sanity

SNT
PHA
SCX
PDX

Comments:

$VER: d0.se 1.14 Copyright © 2011-2024 Tobias Geijersson support at d0 dot se