add smart health read (#300)
Co-authored-by: Furkan YILMAZ <furkan@apziva.com>
This commit is contained in:
co-authored by
Furkan YILMAZ
parent
4b4f000bdb
commit
f82baea56a
@@ -24,6 +24,8 @@ namespace LibreHardwareMonitor.Interop
|
||||
internal const uint NVME_PASS_THROUGH_SRB_IO_CODE = 0xe0002000;
|
||||
internal const byte SMART_LBA_HI = 0xC2;
|
||||
internal const byte SMART_LBA_MID = 0x4F;
|
||||
internal const byte SMART_LBA_HI_EXCEEDED = 0x2C;
|
||||
internal const byte SMART_LBA_MID_EXCEEDED = 0xF4;
|
||||
private const string DllName = "kernel32.dll";
|
||||
|
||||
[Flags]
|
||||
@@ -149,6 +151,19 @@ namespace LibreHardwareMonitor.Interop
|
||||
out uint lpBytesReturned,
|
||||
IntPtr lpOverlapped);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Auto, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal static extern bool DeviceIoControl
|
||||
(
|
||||
SafeHandle hDevice,
|
||||
DFP dwIoControlCode,
|
||||
ref SENDCMDINPARAMS lpInBuffer,
|
||||
int nInBufferSize,
|
||||
out STATUSCMDOUTPARAMS lpOutBuffer,
|
||||
int nOutBufferSize,
|
||||
out uint lpBytesReturned,
|
||||
IntPtr lpOverlapped);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Auto, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal static extern bool DeviceIoControl
|
||||
@@ -589,6 +604,14 @@ namespace LibreHardwareMonitor.Interop
|
||||
public SMART_THRESHOLD[] Thresholds;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
internal struct STATUSCMDOUTPARAMS
|
||||
{
|
||||
public uint cBufferSize;
|
||||
public DRIVERSTATUS DriverStatus;
|
||||
public IDEREGS irDriveRegs;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
internal struct IDENTIFY_DATA
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user