Home > Back-end >  Hard disk of the ATA Command operation
Hard disk of the ATA Command operation

Time:10-22

Below is the SMART of the Command code I wrote, what a great god can help me?

ATA_PASS_THROUGH_EX stCIP={0};
ATA_PASS_THROUGH_EX stCOP={0};
BOOL bRet=FALSE;
DWORD dwRet=0;

StCIP. AtaFlags=ATA_FLAGS_DATA_IN;
StCIP. DataTransferLength=READ_ATTRIBUTE_BUFFER_SIZE;
StCIP. CurrentTaskFile [0]=0 xd0;//the Features
StCIP. CurrentTaskFile [1]=1;//Sector count
StCIP. CurrentTaskFile [2]=0;//Sector number
StCIP. CurrentTaskFile [3]=SMART_CYL_LOW;//Cylinder low
StCIP. CurrentTaskFile [4]=SMART_CYL_HI;//Cylinder high
StCIP. CurrentTaskFile [5]=0 xe0-0xfc;//Device/head
StCIP. CurrentTaskFile [6]=0 xb0;//the Command

BRet=DeviceIoControl (hDevice, IOCTL_ATA_PASS_THROUGH,
& StCIP, sizeof (ATA_PASS_THROUGH_DIRECT) + READ_ATTRIBUTE_BUFFER_SIZE,
& StCOP, sizeof (ATA_PASS_THROUGH_DIRECT) + READ_ATTRIBUTE_BUFFER_SIZE,
& DwRet, NULL);


Finally Getlasterror returns 1306.
  • Related