ATA commands failing every second call RRS feed

  • Question

  • I've written an application that tries to read out harddisks (damaged harddisks, but at the moment I'm testing it with fully functional ones). Now... I'd like to build a driver out of it, but for the moment I'm testing with a normal application and I'm sending commands using DeviceIoControl with IOCTL_ATA_PASS_THROUGH_DIRECT ... (command 0x25 -> Read Sectors Dma Ex) ... the thing is: the first command works... and I get the data... and I have the impression, that it's also working again, when I wait some seconds. But, when I start doing this in a loop, I run into a problem. The commands seem to work (or I don't see how the error value is passed back to me?) but the buffer remains unchanged... so, nothing seems to be read from the disk (sometimes its reading, but normally only the first time... and then later again, but only one block, then fail again... and so on). Does someone have a tip for me what I should check or why this can happen?


    Sunday, February 4, 2018 1:03 PM

All replies

  • Many discoveries were made by mistake... haven't you by chance written an application that produces damaged harddisks? :)

    -- pa

    Sunday, February 4, 2018 2:10 PM
  • sure...

    It seems that Windows did something with the disk too... when I open it exclusively, then the problem seems to go away... but still I don't understand why this should react in this way. And... what I also don't understand... when I set the TimeOutValue to 10... then, I get "media error" reported back to me (after 2.4 seconds... always... seems that's the internal timing of the disk) oh and yes, I'm testing with damaged disks now ... but, when I lower this TimeOutValue to 1 ... then I don't get those errors... somehow I don't get an error at all... or... *hmm*... no idea what I get then... at least someone seems to modify the buffer then... I still don't understand everything...

    ... and I had to go to command 0x20. My new test object seems to support 0x25 and 0x24 but doesn't report back useful data. Also something I don't understand... because I don't think that the electronics is damaged. So I'd expect that this works.

    If someone knows anything... I would appreciate some tips...

    And what's status 0x50? 0x58? "it's transport dependent..." what does that mean? PIO-IN ... fine... but... where can I find that? ... documents... as always they only help you find the information when you already know the information...


    Sunday, February 4, 2018 3:22 PM
  • The latest ATA-documentation is simply crap (unreadable... I don't know what they want to say with their descriptions... or at least I didn't know what they wanted to say, before I didn't read the ATA-5 documentation) ... now I understand it way better... but still... the 0x50 status for example... the 0x10 bit is not documented (only 'na') ... I know, that's not needed anymore... but it would be nice to get some information about what it was... anyway... I guess I have to read even older documents...

    I don't like such things... I want to know why the disk is setting it... because only then I can see if I'm reading the registers correctly.

    ... anyway... I guess nobody understands this.


    Sunday, February 4, 2018 6:38 PM
  • still... why is the status register 0x58 after a ... maybe normal completion of the PIO Read Sectors? ... the documentation says "DRQ shall be cleared to zero" ... any ideas? what do I have to expect if I find this result?


    Sunday, February 4, 2018 11:23 PM