Click here to Skip to main content
15,891,431 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 341.7K   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

 
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 
Hi,

The code here is only to get the SMART parameters from the HDD and not the partition information. How ever the information for partition is stored in sector 0 of the hard drive ( that's what i remember). There are some fixed structures also on how each record is defined with type, size, name etc. I think i saw this in the code project it self. If you can not find it in the code project, let me know. Once i get time, i will upload it as a new article in code project.

Thanks,
Saneesh

Saneesh

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 
GeneralRe: Need help for console application to read HDD temp Pin
Saneesh12-Mar-08 4:39
Saneesh12-Mar-08 4:39 
GeneralRe: Need help for console application to read HDD temp Pin
Shiftlord12-Mar-08 5:24
Shiftlord12-Mar-08 5:24 
GeneralRe: Need help for console application to read HDD temp Pin
Saneesh12-Mar-08 6:34
Saneesh12-Mar-08 6:34 
GeneralRe: Need help for console application to read HDD temp Pin
Shiftlord12-Mar-08 6:41
Shiftlord12-Mar-08 6:41 
GeneralRe: Need help for console application to read HDD temp Pin
Shiftlord14-Mar-08 4:02
Shiftlord14-Mar-08 4:02 
GeneralRe: Need help for console application to read HDD temp Pin
Saneesh14-Mar-08 6:41
Saneesh14-Mar-08 6:41 
GeneralCompiling Error Pin
koala_wk14-Oct-07 17:51
koala_wk14-Oct-07 17:51 
GeneralRe: Compiling Error Pin
Saneesh15-Oct-07 5:15
Saneesh15-Oct-07 5:15 
QuestionAdmin rights required? Pin
oidamoh26-Sep-07 4:16
oidamoh26-Sep-07 4:16 
AnswerRe: Admin rights required? Pin
Saneesh26-Sep-07 11:15
Saneesh26-Sep-07 11:15 
GeneralCannot Detect any information under Vista OS Pin
mywork_00710-Aug-07 20:59
mywork_00710-Aug-07 20:59 

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.