diff -r d93ddd6ca0af -r 194186efdde9 Hardware/HDD/SMART.cs --- a/Hardware/HDD/SMART.cs Thu Oct 07 19:34:36 2010 +0000 +++ b/Hardware/HDD/SMART.cs Fri Oct 08 12:18:32 2010 +0000 @@ -19,7 +19,7 @@ Portions created by the Initial Developer are Copyright (C) 2009-2010 the Initial Developer. All Rights Reserved. - Contributor(s): + Contributor(s): Paul Werelds Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or @@ -36,6 +36,7 @@ */ using System; +using System.Collections.Generic; using System.Runtime.InteropServices; namespace OpenHardwareMonitor.Hardware.HDD { @@ -77,6 +78,14 @@ DriveTemperature = 0xE7 } + public enum SSDLifeID { + None = 0x00, + Indilinx = 0xD1, + Intel = 0xE8, + Samsung = 0xB4, + SandForce = 0xE7 + } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct DriveAttribute { public AttributeID ID; @@ -257,7 +266,9 @@ IntPtr.Zero); } - public static DriveAttribute[] ReadSmart(IntPtr handle, int driveNumber) { + public static List ReadSmart(IntPtr handle, + int driveNumber) + { DriveCommandParameter parameter = new DriveCommandParameter(); DriveSmartReadResult result; uint bytesReturned; @@ -268,15 +279,14 @@ parameter.Registers.LBAHigh = SMART_LBA_HI; parameter.Registers.Command = SMART_CMD; - bool valid = NativeMethods.DeviceIoControl(handle, + bool isValid = NativeMethods.DeviceIoControl(handle, DriveCommand.ReceiveDriveData, ref parameter, Marshal.SizeOf(parameter), out result, Marshal.SizeOf(typeof(DriveSmartReadResult)), out bytesReturned, IntPtr.Zero); - if (!valid) - return null; - else - return result.Attributes; + return (isValid) + ? new List(result.Attributes) + : new List(); } public static string ReadName(IntPtr handle, int driveNumber) {