Modules | |
SMART Return Codes | |
Attribute IDs | |
Device attributes | |
Defines | |
#define | SERIAL_NUM_LEN 20 |
#define | FIRMWARE_REV_LEN 8 |
#define | MODEL_NUM_LEN 40 |
#define | VENDOR_UNIQUE_LEN 3 |
#define | WWN_LEN 8 |
#define | MAX_PARTITIONS_PER_DEVICE 8 |
#define | ATTR_TYPE_STR_DESC 0x20 |
A text description of the attribute. See below for a more detailed description of each attribute. | |
#define | ATTR_TYPE_INT_STATUS 0x40 |
Provided a status for the attribute. OK means the attribute value is well in the safe zone. FAIL means that a Threshold Exceeding Condition has been detected. | |
#define | ATTR_TYPE_INT_VALUE 0x01 |
The current normalized attribute value. | |
#define | ATTR_TYPE_ULONGLONG_RAW 0x02 |
#define | ATTR_TYPE_INT_WORST 0x04 |
The worst (lowest) value recorded so far. This is an indicator of how close to failure the drive has ever been. | |
#define | ATTR_TYPE_INT_THRESHOLD 0x08 |
The attribute threshold. This value will not change and represents the lowest possible safe attribute value. | |
Functions | |
SYSINFO_API int | SysInfoDll_Smart_Init (bool debug, wchar_t *iDebugFile=NULL, bool iRecordTEC=true) |
Call this function to initialize usage of the SMART set of APIs. | |
SYSINFO_API void | SysInfoDll_Smart_Cleanup (void) |
Call this function to clean up memory usage of the DLL after finishing all calls to SysInfo SMART APIs. It de-allocates all memory that was allocated and used by SmartDisk DLL. Calling subsequent SmartDll API calls after SmartDll_Cleanup is an error. | |
SYSINFO_API int | SysInfoDll_Smart_Refresh (bool iRecordTEC=false) |
Call this function to refresh (and re-probe) all SMART devices. If iRecordTEC is true, it records S.M.A.R.T. values for all the available S.M.A.R.T. devices discovered. | |
SYSINFO_API int | SysInfoDll_Smart_GetNumSmartDevices (void) |
Call this function to return the total number of SMART devices detected. | |
SYSINFO_API int | SysInfoDll_Smart_GetNumDetectedDrives (void) |
Call this function to return the total number of volumes detected. | |
SYSINFO_API int | SysInfoDll_Smart_IsValidSmartDevice (int iDeviceID) |
Checks if a particular device ID is a SMART device. | |
SYSINFO_API int | SysInfoDll_Smart_GetDevicePartitionInfo (int *ioDriveNumSameDisk, int *ioNumPartition, int iDeviceID) |
Checks if a particular device ID belongs has multiple partitions. | |
SYSINFO_API int | SysInfoDll_Smart_GetDriveLetterFromDriveNum (wchar_t *ioDriveLetter, int iDriveNum) |
Get the drive letter from the drive number. | |
SYSINFO_API int | SysInfoDll_Smart_GetDeviceSerialNumber (wchar_t *ioBuf, int *ioLen, int iDeviceID) |
Get the serial number of the device. | |
SYSINFO_API int | SysInfoDll_Smart_GetDeviceFirmWareRev (wchar_t *ioBuf, int *ioLen, int iDeviceID) |
Get the firmware revision number of the device. | |
SYSINFO_API int | SysInfoDll_Smart_GetDeviceModelNumber (wchar_t *ioBuf, int *ioLen, int iDeviceID) |
Get the device model number of the device. | |
SYSINFO_API int | SysInfoDll_Smart_GetDeviceCapacity (int *ioCapacity, int iDeviceID) |
Get the capacity of the device in MB . | |
SYSINFO_API int | SysInfoDll_Smart_GetVolumeCapacity (int *ioCapacity, int iDriveNum) |
Get the capacity of a volume in MB . | |
SYSINFO_API int | SysInfoDll_Smart_GetSmartDeviceIDFirst (void) |
Returns the device ID of the first SMART device detected. | |
SYSINFO_API int | SysInfoDll_Smart_GetSmartDeviceIDNext (void) |
Returns the device ID of the next SMART device detected. | |
SYSINFO_API int | SysInfoDll_Smart_GetNumSmartAttr (int iDeviceID) |
Returns the number of SMART attributes for a SMART device. | |
SYSINFO_API int | SysInfoDll_Smart_GetSmartAttributeIDFirst (int iDeviceID) |
Returns the first discovered attribute ID of the SMART device. | |
SYSINFO_API int | SysInfoDll_Smart_GetSmartAttributeIDNext (int iDeviceID) |
Returns the next discovered attribute ID of the SMART device. | |
SYSINFO_API int | SysInfoDll_Smart_GetSmartAttributeByID (void *ioPtr, int *ioLen, int iAttrID, int inAttrType, int iDeviceID) |
Get the attribute value of a particular attribute ID for a SMART device. | |
SYSINFO_API int | SysInfoDll_Smart_GetAttrDescByID (wchar_t *oBuf, int *ioLen, int iAttrID) |
Get the attribute description of a particular attribute ID. | |
SYSINFO_API int | SysInfoDll_Smart_GetDeviceInfo (DEVICEINFO *oDeviceInfo, int iDeviceID) |
Get the device information (such as disk geometry, interface, supported/enabled features). | |
SYSINFO_API int | SysInfoDll_Smart_ExportReport (wchar_t *filename, int iDeviceID, wchar_t *iHeaderText, int iHeaderTextLen, int iExportFlags=3, int iHistoryAttr=0) |
Exports an ASCII text report containing the device information, SMART attribute values and history. | |
SYSINFO_API int | SysInfoDll_Smart_RecordTECData (int iDeviceID) |
Records the current set of normalized and raw attribute values to a binary file for use with TEC prediction. | |
SYSINFO_API int | SysInfoDll_Smart_GetTECDataSetCount (int *ioCount, int iDeviceID) |
Get number of TEC prediction data sets recorded for a particular SMART device. | |
SYSINFO_API int | SysInfoDll_Smart_ExportTECData (time_t *ioTimeArray, int *ioNormValArray, int *ioWorstValArray, int *ioArraySize, int iAttrID, int iDeviceID) |
Extract the TEC prediction data for a particular attribute of a SMART device. | |
SYSINFO_API int | SysInfoDll_Smart_GetTECDataAtIndex (time_t *ioTime, int *ioNormVal, int *ioWorstVal, int inIndex, int iAttrID, int iDeviceID) |
Extract a particular TEC prediction data entry for a particular attribute of a SMART device. | |
SYSINFO_API int | SysInfoDll_Smart_EstimateTECByAttributeID (time_t *ioEarliest, time_t *ioLatest, int iAttrID, int iDeviceID) |
Predicts TEC based on previously recorded TEC prediction data for a particular attribute of a SMART device. | |
SYSINFO_API int | SysInfoDll_Smart_EstimateTEC (time_t *ioEarliest, time_t *ioLatest, int *oAttrID, int iDeviceID) |
Predicts TEC based on previously recorded TEC prediction data for all applicable attributes of a SMART device. |
#define SERIAL_NUM_LEN 20 |
#define FIRMWARE_REV_LEN 8 |
#define MODEL_NUM_LEN 40 |
#define VENDOR_UNIQUE_LEN 3 |
#define WWN_LEN 8 |
#define MAX_PARTITIONS_PER_DEVICE 8 |
#define ATTR_TYPE_STR_DESC 0x20 |
A text description of the attribute. See below for a more detailed description of each attribute.
#define ATTR_TYPE_INT_STATUS 0x40 |
Provided a status for the attribute. OK means the attribute value is well in the safe zone. FAIL means that a Threshold Exceeding Condition has been detected.
#define ATTR_TYPE_INT_VALUE 0x01 |
The current normalized attribute value.
#define ATTR_TYPE_ULONGLONG_RAW 0x02 |
#define ATTR_TYPE_INT_WORST 0x04 |
The worst (lowest) value recorded so far. This is an indicator of how close to failure the drive has ever been.
#define ATTR_TYPE_INT_THRESHOLD 0x08 |
The attribute threshold. This value will not change and represents the lowest possible safe attribute value.
SYSINFO_API int SysInfoDll_Smart_Init | ( | bool | debug, | |
wchar_t * | iDebugFile = NULL , |
|||
bool | iRecordTEC = true | |||
) |
Call this function to initialize usage of the SMART set of APIs.
This function should only be called once. The call enumerates through all detected drives, initializes the proper structures and retrieves SMART values. If SysInfoDll_Smart_Init is not called first, subsequent SysInfo SMART API calls will fail.
[in] | debug | A flag specifying if debug messages should be logged |
[in] | iDebugFile | The name of the debug file to write to. If NULL, "SmartDiskDebug.log" will be used. |
[in] | iRecordTEC | A flag specifying if we want to record and write all SMART attributes to a binary file for the purpose of TEC prediction. This value defaults to true. |
SYSINFO_API void SysInfoDll_Smart_Cleanup | ( | void | ) |
Call this function to clean up memory usage of the DLL after finishing all calls to SysInfo SMART APIs. It de-allocates all memory that was allocated and used by SmartDisk DLL. Calling subsequent SmartDll API calls after SmartDll_Cleanup is an error.
SYSINFO_API int SysInfoDll_Smart_Refresh | ( | bool | iRecordTEC = false |
) |
Call this function to refresh (and re-probe) all SMART devices. If iRecordTEC is true, it records S.M.A.R.T. values for all the available S.M.A.R.T. devices discovered.
[in] | iRecordTEC | A flag specifying if we want to record and write all SMART attributes to a binary file for the purpose of TEC prediction. This value defaults to false. |
SYSINFO_API int SysInfoDll_Smart_GetNumSmartDevices | ( | void | ) |
Call this function to return the total number of SMART devices detected.
SYSINFO_API int SysInfoDll_Smart_GetNumDetectedDrives | ( | void | ) |
Call this function to return the total number of volumes detected.
SYSINFO_API int SysInfoDll_Smart_IsValidSmartDevice | ( | int | iDeviceID | ) |
Checks if a particular device ID is a SMART device.
[in] | iDeviceID | Device ID to check |
SYSINFO_API int SysInfoDll_Smart_GetDevicePartitionInfo | ( | int * | ioDriveNumSameDisk, | |
int * | ioNumPartition, | |||
int | iDeviceID | |||
) |
Checks if a particular device ID belongs has multiple partitions.
A: (floppy) - drive number 0
C: (1st partition on physcial drive 0) - drive number 2
D: (2nd partition on physcial drive 0) - drive number 3
E: (cdrom) - drive number 4
If we call this function and pass in device ID 0, we will get:
ioDriveNumSameDisk = [2,3],
ioNumPartition = 2
Use SysInfoDll_Smart_GetDriveLetterFromDriveNum to convert the drive number to their corresponding letters.
[out] | ioDriveNumSameDisk | array of integers that will store the drive numbers of all the volumes that shares the same physical disk |
[in,out] | ioNumPartition | The size of the ioDriveNumSameDisk array. On return, contains the actual number of items in the array. If buffer is not big enough SMART_ERR_BUFFER_TOO_SMALL will be returned. |
[in] | iDeviceID | Device ID of the hard disk device |
SYSINFO_API int SysInfoDll_Smart_GetDriveLetterFromDriveNum | ( | wchar_t * | ioDriveLetter, | |
int | iDriveNum | |||
) |
Get the drive letter from the drive number.
[out] | ioDriveLetter | pointer to a character to store the drive letter |
[in] | iDriveNum | the drive number of the volume |
SYSINFO_API int SysInfoDll_Smart_GetDeviceSerialNumber | ( | wchar_t * | ioBuf, | |
int * | ioLen, | |||
int | iDeviceID | |||
) |
Get the serial number of the device.
[out] | ioBuf | pre-allocated character buffer to hold serial number string |
[in,out] | ioLen | The size of ioBuf buffer. On return, contains the serial number string length. |
[in] | iDeviceID | Device ID of the hard disk device |
SYSINFO_API int SysInfoDll_Smart_GetDeviceFirmWareRev | ( | wchar_t * | ioBuf, | |
int * | ioLen, | |||
int | iDeviceID | |||
) |
Get the firmware revision number of the device.
[out] | ioBuf | pre-allocated character buffer to hold firmware revision string |
[in,out] | ioLen | The size of ioBuf buffer. On return, contains the firmware revision string length. |
[in] | iDeviceID | Device ID of the hard disk device |
SYSINFO_API int SysInfoDll_Smart_GetDeviceModelNumber | ( | wchar_t * | ioBuf, | |
int * | ioLen, | |||
int | iDeviceID | |||
) |
Get the device model number of the device.
[out] | ioBuf | pre-allocated character buffer to hold device model string. |
[in,out] | ioLen | The size of ioBuf buffer. On return, contains the device model string length. |
[in] | iDeviceID | Device ID of the hard disk device |
SYSINFO_API int SysInfoDll_Smart_GetDeviceCapacity | ( | int * | ioCapacity, | |
int | iDeviceID | |||
) |
Get the capacity of the device in MB .
[out] | ioCapacity | Pointer to an integer to hold capacity in MB. |
[in] | iDeviceID | Device ID of the hard disk device |
SYSINFO_API int SysInfoDll_Smart_GetVolumeCapacity | ( | int * | ioCapacity, | |
int | iDriveNum | |||
) |
Get the capacity of a volume in MB .
[out] | ioCapacity | Pointer to an integer to hold capacity in MB. |
[in] | iDriveNum | the drive number of the volume |
SYSINFO_API int SysInfoDll_Smart_GetSmartDeviceIDFirst | ( | void | ) |
Returns the device ID of the first SMART device detected.
SYSINFO_API int SysInfoDll_Smart_GetSmartDeviceIDNext | ( | void | ) |
Returns the device ID of the next SMART device detected.
SYSINFO_API int SysInfoDll_Smart_GetNumSmartAttr | ( | int | iDeviceID | ) |
Returns the number of SMART attributes for a SMART device.
[in] | iDeviceID | Device ID of the SMART device |
SYSINFO_API int SysInfoDll_Smart_GetSmartAttributeIDFirst | ( | int | iDeviceID | ) |
Returns the first discovered attribute ID of the SMART device.
[in] | iDeviceID | Device ID of the SMART device |
SYSINFO_API int SysInfoDll_Smart_GetSmartAttributeIDNext | ( | int | iDeviceID | ) |
Returns the next discovered attribute ID of the SMART device.
[in] | iDeviceID | Device ID of the SMART device |
SYSINFO_API int SysInfoDll_Smart_GetSmartAttributeByID | ( | void * | ioPtr, | |
int * | ioLen, | |||
int | iAttrID, | |||
int | inAttrType, | |||
int | iDeviceID | |||
) |
Get the attribute value of a particular attribute ID for a SMART device.
[out] | ioPtr | Pointer to store the requested attribute value. The type of pointer depends on inAttrType:
|
[in,out] | ioLen | (ATTR_TYPE_STR_DESC only) Size of the string buffer (in wchar). On return, contains the length of the description string. |
[in] | iAttrID | Attribute IDs you want to get |
[in] | inAttrType | Attribute type to retrieve(See ATTR_TYPE_* ) |
[in] | iDeviceID | Device ID of the SMART device |
SYSINFO_API int SysInfoDll_Smart_GetAttrDescByID | ( | wchar_t * | oBuf, | |
int * | ioLen, | |||
int | iAttrID | |||
) |
Get the attribute description of a particular attribute ID.
[out] | oBuf | A pre-allocated buffer to hold the description string. |
[in,out] | ioLen | Size of the string buffer (in wchar). On return, contains the length of the desc string. |
[in] | iAttrID | Attribute IDs to retrieve the description for |
SYSINFO_API int SysInfoDll_Smart_GetDeviceInfo | ( | DEVICEINFO * | oDeviceInfo, | |
int | iDeviceID | |||
) |
Get the device information (such as disk geometry, interface, supported/enabled features).
[out] | oDeviceInfo | Pointer to a DEVICEINFO struct to hold the info. |
[in] | iDeviceID | Device ID of hard disk device |
SYSINFO_API int SysInfoDll_Smart_ExportReport | ( | wchar_t * | filename, | |
int | iDeviceID, | |||
wchar_t * | iHeaderText, | |||
int | iHeaderTextLen, | |||
int | iExportFlags = 3 , |
|||
int | iHistoryAttr = 0 | |||
) |
Exports an ASCII text report containing the device information, SMART attribute values and history.
[in] | filename | string containing the file path to save the report to |
[in] | iDeviceID | the device ID to generate report for |
[in] | iHeaderText | string containing additional text to be written at the start of the report. |
[in] | iHeaderTextLen | length of the string in iHeaderText. If set to zero, iHeaderText shall be ignored. |
[in] | iExportFlags | flags to indicate which of the following to export:
|
[in] | iHistoryAttr | Attribute IDs to export the history for. Or set to 0 to export the history for all SMART attributes. (ignored if Bit 2 of iExportFlags is not set) |
SYSINFO_API int SysInfoDll_Smart_RecordTECData | ( | int | iDeviceID | ) |
Records the current set of normalized and raw attribute values to a binary file for use with TEC prediction.
[in] | iDeviceID | the device ID to record TEC prediction data for |
SYSINFO_API int SysInfoDll_Smart_GetTECDataSetCount | ( | int * | ioCount, | |
int | iDeviceID | |||
) |
Get number of TEC prediction data sets recorded for a particular SMART device.
[out] | ioCount | number of TEC prediction data sets recorded |
[in] | iDeviceID | the device ID of the SMART device |
SYSINFO_API int SysInfoDll_Smart_ExportTECData | ( | time_t * | ioTimeArray, | |
int * | ioNormValArray, | |||
int * | ioWorstValArray, | |||
int * | ioArraySize, | |||
int | iAttrID, | |||
int | iDeviceID | |||
) |
Extract the TEC prediction data for a particular attribute of a SMART device.
[out] | ioTimeArray | Array of time_t values to store the time of sampling |
[out] | ioNormValArray | Array of integer values to store the normalized values |
[out] | ioWorstValArray | Array of integer values to store the worst values |
[in,out] | ioArraySize | Pointer to the size of the arrays. On successful return, contains actual number of sets of TEC values exported. |
[in] | iAttrID | Attribute IDs to retrieve the history for |
[in] | iDeviceID | the device ID of the SMART device |
SYSINFO_API int SysInfoDll_Smart_GetTECDataAtIndex | ( | time_t * | ioTime, | |
int * | ioNormVal, | |||
int * | ioWorstVal, | |||
int | inIndex, | |||
int | iAttrID, | |||
int | iDeviceID | |||
) |
Extract a particular TEC prediction data entry for a particular attribute of a SMART device.
[out] | ioTime | Pointer to a time_t to store the time of sampling |
[out] | ioNormVal | Pointer to an integer to store the normalized value |
[out] | ioWorstVal | Pointer to an integer to store the worst value |
[in] | inIndex | Index of TEC prediction record to retrieve |
[in] | iAttrID | Attribute IDs to retrieve the history for |
[in] | iDeviceID | the device ID of the SMART device |
SYSINFO_API int SysInfoDll_Smart_EstimateTECByAttributeID | ( | time_t * | ioEarliest, | |
time_t * | ioLatest, | |||
int | iAttrID, | |||
int | iDeviceID | |||
) |
Predicts TEC based on previously recorded TEC prediction data for a particular attribute of a SMART device.
[out] | ioEarliest | Earliest predicted time for failure |
[out] | ioLatest | Latest predicted time for failure |
[in] | iAttrID | Attribute IDs to use to perform TEC prediction |
[in] | iDeviceID | the device ID of the SMART device |
However, note that the following is actually a warning rather than an error:
SYSINFO_API int SysInfoDll_Smart_EstimateTEC | ( | time_t * | ioEarliest, | |
time_t * | ioLatest, | |||
int * | oAttrID, | |||
int | iDeviceID | |||
) |
Predicts TEC based on previously recorded TEC prediction data for all applicable attributes of a SMART device.
[out] | ioEarliest | Earliest predicted time for failure |
[out] | ioLatest | Latest predicted time for failure |
[in] | oAttrID | Attribute IDs used to perform TEC prediction |
[in] | iDeviceID | the device ID of the SMART device |
However, note that the following are actually warnings rather than errors: