2

I want to read a large capacity disk using ATA commands sending though DeviceIoControl(). Sending commands using ATA_PASS_THROUGH_EX structure is the main problem. Actually CurrentTaskFile[] arary of UCHAR type is not able to send a sector no greater than 16777215.

CurrentTaskFile[2] = 0xFF;
CurrentTaskFile[3] = 0xFF;
CurrentTaskFile[4] = 0xFF;

That is
CurrentTaskFile[2] = 0xFF is Sector number register,
CurrentTaskFile[3] = 0xFF is Cylinder low register,
CurrentTaskFile[3] = 0xFF is Cylinder High register.

Now what to do if i want to read sectors no more than 16777215 (If I want to read a 1 TB disk's last sector). How to send sector no more than 16777215. Actually i have to read disk with capacity upto 4 TB.

Anton Savin
  • 40,838
  • 8
  • 54
  • 90
Sam
  • 61
  • 1
  • 10

1 Answers1

2

There is also CurrentTaskFile[5] which is Device/head register. Its range depends on the disk capacity, for example for 4Tb disk it's from 0 to 127. So the maximum number of addressable sectors for that disk is 256*256*256*128 == 2147483648 which seems enough.

Anton Savin
  • 40,838
  • 8
  • 54
  • 90
  • Thanks @AntonSavin for your help. But i can't understand how to use CurrentTaskFile[5](Device/head) register with other registers. Can you discribe how to read sector no more than 16777215 with the combination of all others registers (CurrentTaskFile[2], CurrentTaskFile[3], CurrentTaskFile[4] ). Please help. – Sam May 14 '15 at 05:34
  • @Sam I don't quite understand your question. Just set the values accordingly (sector number, cylinder number and head number) and read whatever sector you want. – Anton Savin May 14 '15 at 06:50