Q208048 --I need this MSDN article ASAP!! Please.

131 views
Skip to first unread message

Doug Cabell

unread,
Nov 11, 2002, 7:18:45 PM11/11/02
to
Q208048 I need this article ASAP. I don't know why
its "not available". If anyone has this please forward it
to me. Thanks very much. Its about SMART monitoring of a
hard disk from Windows.

Regards,
Doug Cabell

Jeff Runaway

unread,
Nov 12, 2002, 1:44:23 AM11/12/02
to

"Doug Cabell" <doug_...@alternate-eye.com> wrote in message
news:e92801c289e1$109b1100$36ef2ecf@tkmsftngxa12...


SAMPLE: SmartApp.exe Accesses SMART Stats in IDE Drives

Q208048


----------------------------------------------------------------------------
----
The information in this article applies to:

a.. Microsoft Win32 Device Driver Kit (DDK), on platform(s):
a.. Microsoft Windows 98
b.. Microsoft Windows 95

----------------------------------------------------------------------------
----


SUMMARY
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.

MORE INFORMATION
The following file is available for download from the Microsoft Download
Center. Click the file name below to download the file:


SmartApp.exe
Release Date: Feb-04-1999

For additional information about how to download Microsoft Support files,
click the article number below to view the article in the Microsoft
Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online Services
Microsoft used the most current virus detection software available on the
date of posting to scan this file for viruses. Once posted, the file is
housed on secure servers that prevent any unauthorized changes to the file.


FileName Size
-----------------------------

SMARTAPP.C 17776
SMARTAPP.H 1613
SMART.H 9857
SMARTAPP.DOC 74240
Using the SMARTAPP sample code
SmartApp.exe is a console application that you run from a DOS command
prompt. You should set up your command prompt window for 43 or 50 lines or
direct the program's output report to a file (for example, type SmartApp.exe
>c:\print.txt) because SmartApp.exe can report over 25 lines of text data.
Following is a sample report produced by SmartApp.exe:

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.
The source code (that is, Smart.h, SmartApp.h, and SmartApp.c) was compiled
and tested using Visual Studio with Microsoft VC++ 5.0 as a console
application.
Common Windows 95 Problems
a.. SMARTVSD packs the structures for the DeviceIoControl in and out
buffers differently from the default packing used by MSVC. The application
needs to specify #pragma pack(1) to get the structure packing to match
SMARTVSD.


b.. SMARTVSD subtracts 1 from the size of the SENDCMDOUTPARAMS when it
validates the size of the SENDCMDOUTPARAMS passed to it by the application.
Using the above packing, the size of the structure in the SMART VSD doc
would be 17 bytes long. SMARTVSD apparently compares the buffer size passed
in DeviceIoControl to 16. This is presumably to discount the variable size
buffer array at the end of the structure, which is defined as 1 byte long in
the docs. The sizes of the SENDCMDINPARAMS and SENDCMDOUTPARAMS structures
specified in the DeviceIoControl call should not include the variable size
buffers located at the end of each structure.
Compiling and Using SmartApp.exe with Windows NT or Windows 2000
To compile SmartApp.exe for Windows NT or Windows 2000, comment out or
delete the following line located at the beginning of SmartApp.c:

#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)
SMARTVSD Troubleshooting Checklist
If opening SMARTVSD fails in Window 95 or Windows 98, one of the following
might be the cause:


a.. You are using the original version of Windows 95, which does not
support SMART (the SDI_506.PDR port driver does not contain IDE PASSTHROUGH
functionality).


b.. SMARTVSD.VXD is not installed in the \windows\system\iosubsys
directory.


c.. You did not restart after installing SMARTVSD.VXD.


d.. Your filesystem is running in Compatibility Mode (see the System
Properties dialog box, click the Performance tab). This means that the
protected mode IOS subsystem, containing SMARTVSD, is being bypassed.


e.. Your system does not have any IDE drives. ESDI_506.PDR does not remain
resident if there are no IDE drives.


f.. Your IDE drives are using a third-party SCSI miniport driver instead
of Microsoft's ESDI_506 driver.


g.. Windows 98 inadvertently omitted SMARTVSD.


If SMARTVSD opens, but you fail to get meaningful data, the IDE drive might
not support SMART (especially older drives).
Common Questions
a.. How does IDE hardware report that it supports SMART functionality?

This information is described in detail in the ATA3 or ATA4 specifications
(see References at the end of this article). Specifically, Word 82 Bit 0 in
the Identify Device structure indicates the drive supports SMART.


b.. How does SMARTVSD communicate with the hard drive(s)?

SMARTVSD is an IOS layered-hierarchy VSD (Vendor Supplied Driver). At the
"top" side, SMARTVSD provides the DeviceIoControl functionality to
communicate with WIN32 applications. At the "bottom" side, SMARTVSD
communicates with the IDE device driver (ESDI_506.PDR) using an API called
IDE Passthrough.

IDE Passthrough was added to the OPK1 version (and later) of Windows 95.
For additional information about this mechanism, please see the following
article(s) in the Microsoft Knowledge Base:

Q196550 HOWTO: Access IDE Controller Registers Using IDE Passthrough
You can use IDE Passthrough to read or write the IDE controller's
registers, from your own IOS layer VSD (Vendor Supplied Driver).
Additional Considerations
Microsoft does not recommend replacing SMARTVSD with your own
implementation. For example, if you want to make your own SCSI miniport
respond to the SMART API (SMARTVSD works only with devices on the IDE bus,
ignoring devices on the SCSI bus). If you do this, you will disable SMART
functionality for other third-party IDE devices that use ESDI_506.

REFERENCES

Small Form Factor Committee (SFF) specifications:
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)
ATA Specifications:
ftp://fission.dt.wdc.com/pub/standards/ata/

ftp://fission.dt.wdc.com/pub/standards/ata/ata-3/ata3-r6.doc
Microsoft Smart IOCTL API Specifications:
http://premium.microsoft.com/msdn/library/specs/d4/iocltapi.htm

http://www.microsoft.com/hwdev/download/respec/iocltapi.rtf
Miscellaneous Resources:
Check out the web sites of companies that manufacture IDE drives, such as
Western Digital, IBM, and Seagate to obtain additional manufacturer-specific
information about SMART technology.

Additional query words:

Keywords : kbfile kbtool kbStorageDev kbOSWin95 kbOSWin98
Issue type : kbhowto
Technology :


Last Reviewed: December 29, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.


CheckAbdoul

unread,
Nov 17, 2002, 1:31:05 PM11/17/02
to
Try
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q208048

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

"Doug Cabell" <doug_...@alternate-eye.com> wrote in message
news:e92801c289e1$109b1100$36ef2ecf@tkmsftngxa12...

heinz baer

unread,
Nov 18, 2002, 12:44:59 AM11/18/02
to
I was amazed to run across the below source code that allows sending
ATA task file commands under Windows 98, NT 4, Windows 2000, and
Windows XP for IDE disk drives! I know of nowhere else you can find
information on how to use undocumented IOCTL_IDE_PASS_THROUGH and yet
this code is a working example. The code also illustrates how to issue
SMART commands. The text is in German, but the code is simple and easy
to follow and comes with 2 pre-built utilities.

ftp://ftp.heise.de/pub/ct/listings/0207-218.zip

I can't find the origins of this code other than the name of the
person who write it in the comments. Wherever you are Matthias,
excellent work!

Together with the below utility to capture the task file commands
going across the bus, IDE pass through is now very much a reality for
developers.

http://www.perisoft.net/bushound

Phil Barila

unread,
Nov 18, 2002, 3:09:05 PM11/18/02
to
"heinz baer" <heinz...@my-deja.com> wrote in message
news:5a47bd7f.02111...@posting.google.com...

As of WinXP without SP, and Win2K SP2, IDE passthrough wasn't documented
because it was still quite buggy. I don't know whether it's been fixed in
either Win2K SP3 or WinXP SP1.

Phil
--
Philip D. Barila
Seagate Technology, LLC
(720) 684-1842
E-mail address is pointed at a domain squatter. Use reply-to instead.


Reply all
Reply to author
Forward
0 new messages