SAMPLE: SmartApp.exe Accesses SMART Stats in IDE DrivesID: Q208048
|
SmartApp.exe is a sample Win32 application that demonstrates how to access the SMART (Self Monitoring, Analysis and Reporting Technology) capabilities built into IDE disk drives.
SMART technology is used to monitor disk drive degradation, in an effort to predict future catastrophic disk failure. For more information about SMART technology, see the REFERENCES section at the end of this article.
While this article primarily centers on using SMART technology with Windows 95 and Windows 98, it also includes information about how to modify SmartApp.exe to work with Windows NT and Windows 2000.
The following file is available for download from the Microsoft
Software Library:
SmartApp.exeRelease Date: Feb-04-1999
Q119591 How to Obtain Microsoft Support Files from Online Services
FileName Size
-----------------------------
SMARTAPP.C 17776
SMARTAPP.H 1613
SMART.H 9857
SMARTAPP.DOC 74240
SMARTVSD opened successfully
DFP_GET_VERSION returned:
bVersion = 1
bRevision = 2
fCapabilities = 0x7
bReserved = 0x0
bIDEDeviceMap = 0x1
cbBytesReturned = 24
SMART Enabled on Drive: 0
cbBytesReturned: 12
Drive 0 is an IDE Hard drive that supports SMART
#Cylinders: 4960, #Heads: 16, #Sectors per Track: 63
IDE TASK FILE REGISTERS:
bFeaturesReg = 0x0
bSectorCountReg = 0x1
bSectorNumberReg = 0x1
bCylLowReg = 0x0
bCylHighReg = 0x0
bDriveHeadReg = 0xA0
Status = 0x50
Model number: WDC AC22500L
Firmware rev: 40.44T40
Serial number: WD-WM3493798728
cbBytesReturned: 512
Data for Drive Number 0
Attribute Structure Revision Threshold Structure Revision
5 5
-Attribute Name- -Attribute Value- -Threshold Value-
1 Raw Read Error Rate 200 51
4 Start/Stop Count 100 40
5 Reallocated Sector Count 200 0
A Spin Retry Count 100 51
B Calibration Retry Count 100 51
C7 (Unknown attribute) 200 0
C8 (Unknown attribute) 100 51
The Attribute fields are defined (and refined) solely by the disk drive OEM manufacturers.
#define WINDOWS9X // Define this to compile for Windows 9x
For Windows NT and Windows 2000, the IOCTL call for SMART_GET_VERSION always returns a bIDEDeviceMap value of 1. You must select the target physical drive using the CreateFile() function. Note that for Windows 95 and Windows 98, the target physical drive is selected after inspecting bIDEDeviceMap. When the symbol WINDOWS9X is not defined (for example, when you are compiling SMARTAPP for the Windows NT or Windows 2000 environment), SMARTAPP currently only opens and reports the first physical drive, using the following:
CreateFile("\\\\.\\PhysicalDrive0",GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL)
To view other drives, change the PhysicalDrive parameter to a value other than 0. Note that you can also open a drive by specifying the drive letter. For example:
CreateFile("\\\\.\\c:",GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL)
Q196550 HOWTO: Access IDE Controller Registers Using IDE PassthroughYou can use IDE Passthrough to read or write the IDE controller's registers, from your own IOS layer VSD (Vendor Supplied Driver).
ftp://fission.dt.wdc.com/pub/standards/SFF/specs/
SFF-8035i (Self-Monitoring, Analysis and Reporting Technology, Version 1.0 May 3, 1995)
INF-8055i (S.M.A.R.T. Applications Guide for the ATA and SCSI interfaces)
ftp://fission.dt.wdc.com/pub/standards/ata/
ftp://fission.dt.wdc.com/pub/standards/ata/ata-3/ata3-r6.doc
http://premium.microsoft.com/msdn/library/specs/d4/iocltapi.htm
http://www.microsoft.com/hwdev/download/respec/iocltapi.rtf
Additional query words:
Keywords : kbtool kbStorageDev kbWinOS95 kbWinOS98
Version : WINDOWS:95
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: March 6, 1999