Click here to Skip to main content
15,885,435 members
Articles / Programming Languages / C++
Article

Hard drive information using S.M.A.R.T.

Rate me:
Please Sign up or sign in to vote.
4.33/5 (31 votes)
25 May 2007 340.8K   18K   70   100
Retrieving Hard drive information using S.M.A.R.T.

Sample Image - SMARTIMAGE.jpg

Introduction

This is very simple program which communicates with the Hard drive to get the information using S.M.A.R.T. available within the hard drive.

The core part is to prepare the command structure and pass it to the device driver which communicates with the hard drive. It uses the DeviceIoControl function. For eg: bRet=DeviceIoControl(hDevice,SMART_SEND_DRIVE_COMMAND,&stCIP,sizeof(stCIP),&stCOP,sizeof(stCOP),&dwRet,NULL);

Don't forget to include the "DDKInclude" folder in the workspace to your VC's include folder before compiling. This sample is only intended for beginners. Most of the information for S.M.A.R.T. is available in the net.

Also the information for each id is stored in an .ini file. You can see that in the Debug / Release folder.

Double click on any of the item in the list box to get more information about it. For e.g., xx sector count

Please contact me for any doubts and i will be happy to answer to your questions

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior)
United States United States
I am from the beautiful sea side town called Kochi ( cochin), Kerala, South India.

Comments and Discussions

 
AnswerRe: Use this Code for C# Pin
Saneesh24-Oct-09 6:35
Saneesh24-Oct-09 6:35 
QuestionRe: Use this Code for C# Pin
MasterChef25-Oct-09 6:10
MasterChef25-Oct-09 6:10 
QuestionHow can read the S.M.A.R.T information with C# Pin
AlexXie23-Aug-09 3:37
AlexXie23-Aug-09 3:37 
AnswerRe: How can read the S.M.A.R.T information with C# Pin
Saneesh24-Aug-09 12:22
Saneesh24-Aug-09 12:22 
GeneralRe: How can read the S.M.A.R.T information with C# Pin
AlexXie25-Aug-09 3:48
AlexXie25-Aug-09 3:48 
GeneralSupport for SCSI HDD Pin
DP3216-Apr-09 6:23
DP3216-Apr-09 6:23 
GeneralRe: Support for SCSI HDD Pin
Saneesh7-Apr-09 6:15
Saneesh7-Apr-09 6:15 
GeneralRe: Support for SCSI HDD Pin
sukhas198-Apr-09 18:08
sukhas198-Apr-09 18:08 
Hi Saneesh,
DeviceIoControl control returns the error code 1117 which is error code for I/O device error.

Regards,
Sukhas
GeneralRe: Support for SCSI HDD Pin
sukhas1919-Apr-09 21:00
sukhas1919-Apr-09 21:00 
GeneralRe: Support for SCSI HDD Pin
Saneesh21-Apr-09 4:12
Saneesh21-Apr-09 4:12 
GeneralRe: Support for SCSI HDD Pin
Saneesh21-Apr-09 4:13
Saneesh21-Apr-09 4:13 
GeneralThresholds Pin
Kenshin2k29-Dec-08 22:18
Kenshin2k29-Dec-08 22:18 
GeneralRe: Thresholds Pin
Saneesh30-Dec-08 3:42
Saneesh30-Dec-08 3:42 
Questionsmall bug's? Pin
CodeFlatter5-Sep-08 4:28
CodeFlatter5-Sep-08 4:28 
AnswerRe: small bug's? Pin
Saneesh5-Sep-08 7:34
Saneesh5-Sep-08 7:34 
GeneralAwesome mate !! Pin
asold200723-Aug-08 16:45
asold200723-Aug-08 16:45 
GeneralRe: Awesome mate !! Pin
Saneesh23-Aug-08 16:54
Saneesh23-Aug-08 16:54 
Questionhow to get the partition or size of the disk?? [modified] Pin
warr~~en19-Jun-08 22:18
warr~~en19-Jun-08 22:18 
AnswerRe: how to get the partition or size of the disk?? Pin
Saneesh20-Jun-08 3:59
Saneesh20-Jun-08 3:59 
GeneralRe: how to get the partition or size of the disk?? Pin
warr~~en20-Jun-08 4:39
warr~~en20-Jun-08 4:39 
GeneralNo drives detected Pin
jaque-o12-Jun-08 22:55
jaque-o12-Jun-08 22:55 
GeneralRe: No drives detected Pin
Saneesh13-Jun-08 4:05
Saneesh13-Jun-08 4:05 
QuestionHow to use DeviceIoControl() api to write IDE HDD one or multiple sectors? Pin
itri9483422-Jun-08 1:34
itri9483422-Jun-08 1:34 
AnswerRe: How to use DeviceIoControl() api to write IDE HDD one or multiple sectors? Pin
Saneesh2-Jun-08 6:59
Saneesh2-Jun-08 6:59 
GeneralNeed help for console application to read HDD temp Pin
Shiftlord11-Mar-08 23:10
Shiftlord11-Mar-08 23:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.