|
Hi,
Why the threshold values always are zero? Anather application for HDD control has another values.
|
|
|
|
|
Is it 0 for all of them??? or of just one of the parameters?
Saneesh
|
|
|
|
|
The threshold values for some attributes may be 0. It is right. But it is 0 for all attributes! I can't understand why it is so
Help me, please!
|
|
|
|
|
When u compare the other values with the output from the other program u used, are they same? and only threshold is 0? May be there is some information / the index may be different for your particular model and my code is not checking for that. Can you debug the follwing code and see that you are getting? from function BOOL CSmartReader::ReadSMARTAttributes(HANDLE hDevice,UCHAR ucDriveIndex)
bRet=DeviceIoControl(hDevice,SMART_RCV_DRIVE_DATA,&stCIP,sizeof(stCIP),szAttributes,sizeof(ST_ATAOUTPARAM) + READ_ATTRIBUTE_BUFFER_SIZE - 1,&dwRet,NULL);
if(bRet)
{
pT1=(PBYTE)(((ST_ATAOUTPARAM*)szAttributes)->bBuffer);
for(ucT1=0;ucT1<30;++ucT1)
{
pT2=(PDWORD)&pT1[2+ucT1*12+5];
pT3=&pT1[2+ucT1*12];
pT3[INDEX_ATTRIB_RAW+2]=pT3[INDEX_ATTRIB_RAW+3]=pT3[INDEX_ATTRIB_RAW+4]=pT3[INDEX_ATTRIB_RAW+5]=pT3[INDEX_ATTRIB_RAW+6]=0;
if(pT3[0]!=0)
{
pSmartValues=GetSMARTValue(ucDriveIndex,pT3[0]);
if(pSmartValues)
pSmartValues->m_dwThreshold=pT2[0];
}
}
}
return bRet;
Saneesh
|
|
|
|
|
Hello, Saneesh! Sorry for my long silence.
I debug your specified code and look it's result.
After execution the following step
pSmartValues=GetSMARTValue(ucDriveIndex,pT3[0]);
the pSmartValues.m_dwThreshold is 4294967295. But the pT2[0] value is always 0, so after assignment statement pSmartValues->m_dwThreshold=pT2[0] the pSmartValues.m_dwThreshold value is 0 too.
So, can you help me to understand the pT2 variable meaning?
|
|
|
|
|
Looking at Section 2.6 of the SFF 8035i Revision 2 SMART Specification, titled "SMART Read Attribute Thresholds", the buffer beginning at OutParams.stCOP.bBuffer contains a 512 byte structure. This structure contains, among other things, a collection of smaller structures which include the threshold data. These structures are easily coded as something like this:
<br />
#define SMART_MAX_ATTRIBUTES 30<br />
#define SMART_MAX_THRESHOLDS 30<br />
<br />
#pragma pack( push, 1 )// Structures must be aligned on a single-byte boundary!<br />
typedef struct<br />
{<br />
BYTE ucId;<br />
BYTE ucValue;<br />
BYTE ucReserved[10];<br />
<br />
} SMART_THRESHOLD_INFO, *LPSMART_THRESHOLD_INFO;<br />
<br />
typedef struct<br />
{<br />
WORD wRevision;<br />
SMART_THRESHOLD_INFO arThresholds[ SMART_MAX_THRESHOLDS ];<br />
BYTE ucReserved[18];<br />
BYTE ucVendorSpecific[131];<br />
BYTE ucChecksum;<br />
<br />
} SMART_THRESHOLDS, *LPSMART_THRESHOLDS;<br />
#pragma pack( pop )<br />
With these structures in hand, we can modify the "Read Thresholds" code to be a bit easier to follow...
<br />
LPSMART_THRESHOLDS pThresholds = (LPSMART_THRESHOLDS)OutParams.stCOP.bBuffer;<br />
<br />
for( ucT1 = 0; ucT1 < SMART_MAX_THRESHOLDS; ucT1++ )<br />
{<br />
SMART_THRESHOLD_INFO& info = pThresholds->arThresholds[ ucT1 ];<br />
<br />
if( info.ucId != 0 )<br />
{<br />
pSmartValues = GetSMARTValue( ucDriveIndex, info.ucId );<br />
<br />
if( pSmartValues )<br />
pSmartValues->m_dwThreshold = info.ucValue;<br />
}<br />
}<br />
This same approach could, of course, be applied to the code which reads the attributes in as well. I'll leave that as an exercise for the reader...
Hope this helps!
- NL
*Real* programmers use "copy con:progname.exe"!
|
|
|
|
|
I tried your executable on a server with 2 HDD's using a RAID controller. And actually I was hoping to see 2 hdd's status accoording to SMART protocol, but I just get one. I understand that the OS sees only one hdd ( actually 2 parallel RAID1 ), so is there a way to achieve that, or is there some kind of an api needed delivered by the manufacturer?
Thank you!
**We are an example of helping each other**
|
|
|
|
|
Hi,
I never tried/see it like the way you have described. Well the way to open the drive is in "wsprintf(szT1,"\\\\.\\PHYSICALDRIVE%d",ucDriveIndex);
hDevice=CreateFile(szT1,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_SYSTEM,NULL);".
If the device driver can see it, i guess a different PHYSICALDRIVE should make it work. Does it shows up as two different HDD in control panel.
Which drive's data are you getting?
Saneesh
|
|
|
|
|
Saneesh,
Thank you for your reply.
I haven't tried it yest, but what I found out is that it sees a USB-memorystick also as a physical drive. so that physical drive thing is not just for the HDD only. You'll hear it soon from me about raid set.
Thank you.
**We are an example of helping each other**
|
|
|
|
|
I am trying to get the serial number from a SATA drive when running Vista Ultimate. I attempt to get a handle to the C: drive via:
HANDLE handle = CreateFile("\\\\.\\C:", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
But unless I am Admin on Vista cannot get a handle, and promoting all our users to Admin isn't an option. So, basically my question is: has anyone been able to get a SATA serial number under Vista?
D_
|
|
|
|
|
Did you tried that with .Net? I guess that will be a lot easier.
- Is there a way like you can change the user to power user?
- Try to impersonate the program as an administrator and you should get the required privilege.
Saneesh
|
|
|
|
|
Hi Saneesh,
I have Windows XP Pro with VS 2005. When I compiled I get cannot open include file: 'devioctl.h'. I did add DDKInclude to my project path, but it still doesn't work. What am I missing? Thanks.
-hdpc
|
|
|
|
|
Can you try to forcefully include the path? I mean in smartreader.h
replace
#include <devioctl.h>
#include <ntdddisk.h>
with
#include "yourpath\\devioctl.h"
#include "yourpath\\ntdddisk.h"
Saneesh
|
|
|
|
|
Thanks Saneesh, that works. Not sure why the other way didn't work. Oh well as long as it works is good with me. Thanks again!
-hdpc
|
|
|
|
|
strange output and strange ratings
tugak@bigfoot.com
|
|
|
|
|
What happened with output? Ratings..dont know how it happened..
Saneesh
|
|
|
|
|
Temperature looks a bit strange on my HITACHI DK23EB-40.
Value: 58, Worst: 42, RAW: 61 , also "Seek Error Rate"
constantly increasing when system idle. No idea why.
|
|
|
|
|
RAW is the current value from the hard drive. Can you turn off the PC for some time (let it cool down) and try again?
Also If Seek Error rate increase, it is dangerous. Use FileMon from sysinternals to see who is accessing the hard drive when the system is idle.
Hope this information helps
Saneesh
|
|
|
|
|
Well, I more curious about "Worst: 42", should it be lower than Raw?
Probably not. On my return home I'll check disk with smartmontools and
report if found something different.
|
|
|
|
|
Hi,
Increasing "seek Error Rate" along with "Raw Read Error Rate" is not a very bad sign. Also when this values are changing like this, your hard drive should be making lot of noise on read/ write like KRRRRRRRRRRRRRRRRR sound. The hard drive is getting slower, how ever it does not die within a day or two. It is just slowing down.
Value and RAW value for temperature should change one to one. Can you check and see if the temperature is really high on the hard drive? Take it out and see how hot it is.
Thanks,
Saneesh
Saneesh
|
|
|
|
|
Never seen that o_O
Kochise
In Code we trust !
|
|
|
|
|
ok, the article perhaps lacks of some details, but c'mon it really isn't THAT bad!
but it's getting better... now it has 8 votes and a rating of -36.8.
cheers,
mykel
If they give you lined paper, write the other way!
|
|
|
|
|
I know i am very poor in writing details. I will update it as soon as i am little bit free from work
Saneesh
|
|
|
|
|
Please check the source zip file.
Thanks,
|
|
|
|
|
Hi,
Please check it again. Thanks for the information.
Saneesh
Saneesh
|
|
|
|