123 switch ( attributeId )
125 case 0x01: r = isEnglish ? _T(
"Raw read error rate") : _T(
"読み込みエラー率");
127 case 0x02: r = isEnglish ? _T(
"Throughput performance") : _T(
"スループット");
129 case 0x03: r = isEnglish ? _T(
"Spinup time") : _T(
"スピンアップ時間");
131 case 0x04: r = isEnglish ? _T(
"Start/Stop count") : _T(
"回転/停止数");
133 case 0x05: r = isEnglish ? _T(
"Reallocated sector count") : _T(
"再割り当てセクター数");
135 case 0x06: r = isEnglish ? _T(
"Read channel margin") : _T(
"リード・チャンネル・マージン");
137 case 0x07: r = isEnglish ? _T(
"Seek error rate") : _T(
"シークエラー率");
139 case 0x08: r = isEnglish ? _T(
"Seek timer performance") : _T(
"シークタイム性能");
141 case 0x09: r = isEnglish ? _T(
"Power-on hours count") : _T(
"合計利用時間");
143 case 0x0A: r = isEnglish ? _T(
"Spinup retry count") : _T(
"スピンアップ再試行回数");
145 case 0x0B: r = isEnglish ? _T(
"Calibration retry count") : _T(
"キャリブレーション再試行回数");
147 case 0x0C: r = isEnglish ? _T(
"Power cycle count") : _T(
"電源投入回数");
150 case 0xC9: r = isEnglish ? _T(
"Soft read error rate") : _T(
"論理読み込みエラー率");
154 case 0xBE: r = isEnglish ? _T(
"vendor-specific") : _T(
"ベンダー独自情報");
156 case 0xBF: r = isEnglish ? _T(
"G-sense error rate") : _T(
"加速度センサー検出エラー率");
158 case 0xC0: r = isEnglish ? _T(
"Power-off retract count") : _T(
"電源切断回避数");
160 case 0xC1: r = isEnglish ? _T(
"Load/Unload cycle count") : _T(
"ロード/アンロード・サイクル数");
162 case 0xC2: r = isEnglish ? _T(
"HDA temperature") : _T(
"温度");
164 case 0xC3: r = isEnglish ? _T(
"Hardware ECC recovered") : _T(
"ハードウエアECC復旧");
166 case 0xC4: r = isEnglish ? _T(
"Reallocation count") : _T(
"再割り当て数");
168 case 0xC5: r = isEnglish ? _T(
"Current pending sector count") : _T(
"不安定セクター数");
170 case 0xC6: r = isEnglish ? _T(
"Offline scan uncorrectable count") : _T(
"未訂正エラー数");
172 case 0xC7: r = isEnglish ? _T(
"UDMA CRC error rate") : _T(
"UltraDMA CRCエラー");
174 case 0xC8: r = isEnglish ? _T(
"Write error rate") : _T(
"書き込みエラー率");
177 case 0xCA: r = isEnglish ? _T(
"Data Address Mark errors") : _T(
"DAM(Data Address Mark)エラー");
179 case 0xCB: r = isEnglish ? _T(
"Run out cancel") : _T(
"ECCエラー");
181 case 0xCC: r = isEnglish ? _T(
"Soft ECC correction") : _T(
"論理ECC訂正");
183 case 0xCD: r = isEnglish ? _T(
"Thermal asperity rate(TAR)") : _T(
"熱エラー率(TAR)");
185 case 0xCE: r = isEnglish ? _T(
"Flying height") : _T(
"ヘッド高");
187 case 0xCF: r = isEnglish ? _T(
"Spin high current") : _T(
"最大回転電流");
189 case 0xD0: r = isEnglish ? _T(
"Spin buzz") : _T(
"ヘッド制御");
191 case 0xD1: r = isEnglish ? _T(
"Offline seek performance") : _T(
"オフライン・シーク性能");
193 case 0xDC: r = isEnglish ? _T(
"Disk shift") : _T(
"ディスク交換");
195 case 0xDD: r = isEnglish ? _T(
"G-sense error rate") : _T(
"加速度センサー検出エラー率");
197 case 0xDE: r = isEnglish ? _T(
"Loaded hours") : _T(
"利用時間");
199 case 0xDF: r = isEnglish ? _T(
"Load/unload retry count") : _T(
"ロード/アンロード再試行回数");
201 case 0xE0: r = isEnglish ? _T(
"Load friction") : _T(
"ロード抵抗");
203 case 0xE1: r = isEnglish ? _T(
"Load/Unload cycle count") : _T(
"ロード/アンロード・サイクル数");
205 case 0xE2: r = isEnglish ? _T(
"Load-in time") : _T(
"ロードイン時間");
207 case 0xE3: r = isEnglish ? _T(
"Torque amplification count") : _T(
"トルク増幅数");
209 case 0xE4: r = isEnglish ? _T(
"Power-off retract count") : _T(
"電源切断退避数");
211 case 0xE6: r = isEnglish ? _T(
"GMR head amplitude") : _T(
"GMRヘッド振幅");
213 case 0xE7: r = isEnglish ? _T(
"Temperature") : _T(
"温度");
215 case 0xF0: r = isEnglish ? _T(
"Head flying hours") : _T(
"シーク移動時間");
217 case 0xFA: r = isEnglish ? _T(
"Read error retry rate") : _T(
"読み込みエラー再試行数");
220 r = isEnglish ? _T(
"Unknown") : _T(
"不明");
245 m_isValidVersion =
false;
246 return m_Collect(deviceNo);
256 return m_isValidVersion ? &m_version : NULL;
266 return m_infos.GetSize();
277 if ( m_infos.IsInRange(index) )
279 return m_infos[index];
292 loop ( i, m_infos.GetSize() )
294 if ( m_infos[i]->bAttrID ==
id )
350 DFP_GET_VERSION = 0x00074080,
351 DFP_RECEIVE_DRIVE_DATA = 0x0007c088,
354 struct TReadAttrData : SENDCMDOUTPARAMS
356 BYTE bb[READ_ATTRIBUTE_BUFFER_SIZE - 1];
360 bool m_Collect(
int deviceNo)
363 dev.
Format(_T(
"\\\\.\\PhysicalDrive%d"), deviceNo);
364 HANDLE h = ::CreateFile(dev, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
365 if ( h == INVALID_HANDLE_VALUE )
371 bool r1 = !! ::DeviceIoControl(h, DFP_GET_VERSION, NULL, 0, &m_version,
sizeof(m_version), &dwReturned, NULL);
377 m_isValidVersion =
true;
383 sc.irDriveRegs.bFeaturesReg = READ_ATTRIBUTES;
384 sc.irDriveRegs.bCylLowReg = SMART_CYL_LOW;
385 sc.irDriveRegs.bCylHighReg = SMART_CYL_HI;
386 sc.irDriveRegs.bDriveHeadReg =
static_cast<BYTE
>(0xA0 | ((deviceNo & 1) << 4));
387 sc.irDriveRegs.bCommandReg = SMART_CMD;
388 sc.cBufferSize = READ_ATTRIBUTE_BUFFER_SIZE;
389 sc.bDriveNumber =
static_cast<BYTE
>(deviceNo);
390 bool r2 = !! ::DeviceIoControl(h, DFP_RECEIVE_DRIVE_DATA, &sc,
sizeof(sc), &ra,
sizeof(ra), &dwReturned, NULL);
392 if ( r2 && dwReturned ==
sizeof(TReadAttrData) )
394 return m_SetRowData(READ_ATTRIBUTE_BUFFER_SIZE, ra.bBuffer);
399 bool m_SetRowData(
size_t size,
const void* pData)
402 if ( size != READ_ATTRIBUTE_BUFFER_SIZE)
406 m_rowData.
Reset(size,
static_cast<const BYTE*
>(pData));
407 TAttribute* pAttribute =
reinterpret_cast<TAttribute*
>(&m_rowData[2]);
410 if ( pAttribute->bAttrID != 0 )
412 m_infos.Add(pAttribute);
422 bool m_isValidVersion;
#define loop(VAR, CNT)
loop構文.
SMART (Self Monitoring, Analysis and Reporting Technology)アクセスクラス.
const TAttribute * FindAttributeId(BYTE id) const
[取得] 属性情報取得.
const TAttribute * GetAttribute(INDEX index) const
[取得] 属性情報取得.
size_t GetAttributeCount(void) const
[取得] 属性数取得.
int GetTemperature(void) const
[取得] 温度情報取得.
CSmartAccessor(void)
コンストラクタ
const TVersion * GetVersion(void) const
[取得] バージョン情報取得.
int GetPowerCycleCount(void) const
[取得] 電源投入回数取得.
bool Collect(int deviceNo)
[取得] 収集.
int GetPowerOnHoursCount(void) const
[取得] 合計利用時間取得.
void Format(const TYP *lpszFormat,...)
[代入] 書式付き文字列代入.
void Reset(size_t l, const TYP *P)
[設定] 再設定
int ToInt(LPCSTR lpsz, int iBase=10)
[変換] INT変換(ASCII/SJIS用).
void Zero(V &value)
[設定] ゼロクリア.
WORD bRawValue[3]
Un-normalized value
static CStr GetAttributeIdString(BYTE attributeId, bool isEnglish=true)
[取得] 属性ID文字列取得
BYTE bAttrValue
Current normalized value
BYTE bWorstValue
How bad has it ever been?
CStr GetAttributeIdString(bool isEnglish=true) const
[取得] 属性ID文字列取得
BYTE bAttrID
Identifies which attribute
ULONGLONG GetValue(void) const
[取得] Un-normalized value取得 bRawValue[3] を 48bit 値として返します。
WORD wStatusFlags
see bit definitions below
CStr ToString(void) const
[取得] 文字列化 現在の値 ワーストの値 生データx6 の文字列を生成します。
DWORD fCapabilities
Bit mask of driver capabilities.
DWORD dwReserved[4]
For future use.
BYTE bIDEDeviceMap
Bit map of IDE devices.
BYTE bRevision
Binary driver revision.
BYTE bVersion
Binary driver version.