I want to read LBA 60 of HDD with DeviceIoControl(). When i send ReadDMAExt(0x25) command with DeviceIoControl() it success…no error but in output buffer there is no data…i have taken help of DiskExplorer software to see content of LBA 60, there Its showing some data but not with DeviceIoConrol(). Below is my Code sample for Reading LBA. Need Help…
pSCIP->AtaFlags=ATA_FLAGS_DATA_IN |ATA_FLAGS_48BIT_COMMAND |ATA_FLAGS_USE_DMA;pSCIP->Length=sizeof(ATAData);pSCIP->DataTransferLength=1000;pSCIP->TimeOutValue=20;pSCIP->DataBuffer=pSCOP->output_buff;pSCIP->PreviousTaskFile[0]=0;pSCIP->PreviousTaskFile[1]=1;pSCIP->PreviousTaskFile[2]=0;pSCIP->PreviousTaskFile[3]=0;pSCIP->PreviousTaskFile[4]=0;pSCIP->PreviousTaskFile[5]=0x40;//pSCIP->PreviousTaskFile[6]=0;pSCIP->PreviousTaskFile[7]=0;pSCIP->CurrentTaskFile[0]=0;pSCIP->CurrentTaskFile[1]=0x0;pSCIP->CurrentTaskFile[2]=0x60;// LBA 60pSCIP->CurrentTaskFile[3]=0x00;pSCIP->CurrentTaskFile[4]=0x00;pSCIP->CurrentTaskFile[5]=0x40;pSCIP->CurrentTaskFile[6]=0x25;//Read DMA EXtpSCIP->CurrentTaskFile[7]=0;pSCIP->TargetId=bDriveNum;val=DeviceIoControl(hSMARTIOCTL,IOCTL_ATA_PASS_THROUGH_DIRECT,pSCIP,sizeof(ATAdirect),pSCOP,sizeof(ATAdirect),lpcbBytesReturned,NULL);
Guys i notice one thing that for some hard disks my method is working but not with all…any reason why???
On Tuesday, 29 July 2014 1:35 PM, Naresh Mahandru wrote:
I want to read LBA 60 of HDD with DeviceIoControl(). When i send ReadDMAExt(0x25) command with DeviceIoControl() it success…no error but in output buffer there is no data…i have taken help of DiskExplorer software to see content of LBA 60, there Its showing some data but not with DeviceIoConrol(). Below is my Code sample for Reading LBA. Need Help…
pSCIP->AtaFlags=ATA_FLAGS_DATA_IN |ATA_FLAGS_48BIT_COMMAND |ATA_FLAGS_USE_DMA;pSCIP->Length=sizeof(ATAData);pSCIP->DataTransferLength=1000;pSCIP->TimeOutValue=20;pSCIP->DataBuffer=pSCOP->output_buff;pSCIP->PreviousTaskFile[0]=0;pSCIP->PreviousTaskFile[1]=1;pSCIP->PreviousTaskFile[2]=0;pSCIP->PreviousTaskFile[3]=0;pSCIP->PreviousTaskFile[4]=0;pSCIP->PreviousTaskFile[5]=0x40;//pSCIP->PreviousTaskFile[6]=0;pSCIP->PreviousTaskFile[7]=0;pSCIP->CurrentTaskFile[0]=0;pSCIP->CurrentTaskFile[1]=0x0;pSCIP->CurrentTaskFile[2]=0x60;// LBA 60pSCIP->CurrentTaskFile[3]=0x00;pSCIP->CurrentTaskFile[4]=0x00;pSCIP->CurrentTaskFile[5]=0x40;pSCIP->CurrentTaskFile[6]=0x25;//Read DMA EXtpSCIP->CurrentTaskFile[7]=0;pSCIP->TargetId=bDriveNum;val=DeviceIoControl(hSMARTIOCTL,IOCTL_ATA_PASS_THROUGH_DIRECT,pSCIP,sizeof(ATAdirect),pSCOP,sizeof(ATAdirect),lpcbBytesReturned,NULL);
—
NTFSD is sponsored by OSR
OSR is hiring!! Info at http://www.osr.com/careers
For our schedule of debugging and file system seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Is you just want to read an LBA, why not get a handle to the physical disk and use ReadFile() instead?