Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Read SMART DATA from HDD

$
0
0

Hi guys,

 I m trying to read SMART attributes and print on the screen using windows API but i dont know here how to read and print in C++. I have written a small code

SENDCMDINPARAMS stCIP={0};
	SENDCMDOUTPARAMS stCOP={0};
	DWORD dwRet=0;
	BOOL bRet=FALSE;
	BYTE	szAttributes[sizeof(SENDCMDOUTPARAMS) + READ_ATTRIBUTE_BUFFER_SIZE - 1];

	stCIP.cBufferSize=0;
	stCIP.bDriveNumber = drive;
	stCIP.irDriveRegs.bFeaturesReg= 0xD0;
	stCIP.irDriveRegs.bSectorCountReg = 1;
	stCIP.irDriveRegs.bSectorNumberReg = 1;
	stCIP.irDriveRegs.bCylLowReg = 0x4F;
	stCIP.irDriveRegs.bCylHighReg = 0xC2;
	stCIP.irDriveRegs.bDriveHeadReg = 0xA0 | ((drive & 1) << 4);
	stCIP.irDriveRegs.bCommandReg = 0xB0;
	bRet=DeviceIoControl(handle,SMART_RCV_DRIVE_DATA,&stCIP,sizeof(stCIP),szAttributes,sizeof(SENDCMDOUTPARAMS)+ READ_ATTRIBUTE_BUFFER_SIZE - 1,&dwRet,NULL);
	//std::cout<<"output="<<dwRet<<std::endl;
	//printf("\n");

	USHORT *arr=(USHORT *)(((SENDCMDOUTPARAMS*)szAttributes)->bBuffer);
please help me to print attributes on screen .....
 



Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>