Click here to Skip to main content
15,909,039 members

Comments by Vincentchien (Top 1 by date)

Vincentchien 12-Mar-13 21:29pm View    
Hello Matthew,

I'm writing a HDD test utility in Windows XP platform, EXECUTE_DEVICE_DIAGNOSTIC and READ_VERIFY_SECTOR are ATA command.

WORD inputBuffer[6];

inputBuffer[0]=0; //reserved
inputBuffer[1]=6*2; // size of this buffer
inputBuffer[2]=0;
inputBuffer[3]=0
inputBuffer[4]=0
inputBuffer[5]=0x90; ATA command, 90h means EXECUTE_DEVICE_DIAGNOSTIC

hDevice=CreateFile("\\\\.\\PHYSICALDRIVE0,...);

bRet=DeviceIoControl(hDevice,EXECUTE_DEVICE_DIAGNOSTIC,inoutBuffer...)

CloseHandle(hDevice);

The bRet always fail, and GetLastError() equal to 87, its means incorrect parameters, please help, or have any sample code for that.