Page 1 of 1

Offset to Disk information

Posted: Mon Jul 02, 2007 10:53 am
by d4n1l0d
How can I know the disk information (the cluster , side and track number ) of any OFFSET ( like 0x3533 ) ???

Posted: Mon Jul 02, 2007 11:03 am
by frank
Here is a little C that will extract that information. LBA is the offset from the start of the disk in sectors (0 based). The rest looks pretty easy to figure out.

Code: Select all

cylinder = LBA / ( heads_per_cylinder * sectors_per_track );
head = ( LBA / sectors_per_track ) % heads_per_cylinder;
sector = ( LBA % sectors_per_track ) + 1;
And here is some code to reverse the process.

Code: Select all

LBA = ( (cylinder * heads_per_cylinder + heads ) * sectors_per_track ) + sector - 1;

Posted: Mon Jul 02, 2007 11:27 am
by d4n1l0d
Ok! Thank you!!!!

Posted: Mon Jul 02, 2007 12:51 pm
by Ninjarider
thnx. thought that is how it was done. must remember.