Skip to content

Commit 7b55a1a

Browse files
committed
Removed temperature reading feature entirely from the client including the required LibreHardwareMonitor package.
This was in response to Windows tightening security around the ring0 driver making this feature unfeasible for now.
1 parent 85c3ac0 commit 7b55a1a

6 files changed

Lines changed: 0 additions & 98 deletions

File tree

client/Monolith.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ public class MonolithHardware
357357
public List<Dictionary<string, object>> Devices;
358358
public List<Dictionary<string, object>> BiosInfo;
359359
public List<DiskDrive> Storage;
360-
public List<TempMeasurement> Temperatures;
361360
public List<BatteryData> Batteries;
362361
public bool WriteSuccess;
363362
public int ErrorCount;
@@ -374,7 +373,6 @@ public MonolithHardware()
374373
Devices = Cache.Devices;
375374
BiosInfo = Cache.BiosInfo;
376375
Storage = Cache.Disks;
377-
Temperatures = Cache.Temperatures;
378376
Batteries = Cache.Batteries;
379377
WriteSuccess = Cache.HardwareWriteSuccess;
380378
ErrorCount = DebugLog.ErrorCount[(int)DebugLog.Region.Hardware];

client/data/Cache.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public static partial class Cache
6262
public static Dictionary<string, object> Tpm { get; private set; }
6363
public static List<Dictionary<string, object>> Drivers { get; private set; }
6464
public static List<Dictionary<string, object>> Devices { get; private set; }
65-
public static List<TempMeasurement> Temperatures { get; private set; }
6665
public static List<BatteryData> Batteries { get; private set; }
6766
public static bool? SecureBootEnabled { get; private set; }
6867
public static List<IRegistryValue> ChoiceRegistryValues { get; private set; }

client/data/Methods/Hardware.cs

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#if !NORING
2-
using LibreHardwareMonitor.Hardware;
3-
#endif
41
using Microsoft.Win32;
52
using Newtonsoft.Json;
63
using Newtonsoft.Json.Linq;
@@ -34,7 +31,6 @@ public static async Task MakeHardwareData()
3431

3532
List<Task> hardwareTaskList = new()
3633
{
37-
DoTask(region, "GetTemps", GetTemps),
3834
DoTask(region, "GetHardwareWmiData", GetHardwareWmiData),
3935
DoTask(region, "GetMonitorInfo", GetMonitorInfo),
4036
DoTask(region, "GetSMBiosMemoryInfo", GetSMBiosMemoryInfo),
@@ -1313,61 +1309,6 @@ private static string GetAttributeName(byte id)
13131309
;
13141310
}
13151311

1316-
// TEMPERATURES
1317-
private static async Task GetTemps()
1318-
{
1319-
#if NORING
1320-
await LogEventAsync($"Specify No Ring 0 version running. Temperatures will not be collected.", Region.Hardware, EventType.WARNING);
1321-
#else
1322-
//Any temp sensor reading below 24 will be filtered out
1323-
//These sensors are either not reading in celsius, are in error, or we cannot interpret them properly here
1324-
var Temps = new List<TempMeasurement>();
1325-
var computer = new Computer
1326-
{
1327-
IsCpuEnabled = true,
1328-
IsGpuEnabled = true,
1329-
IsMotherboardEnabled = true
1330-
};
1331-
1332-
try
1333-
{
1334-
computer.Open();
1335-
computer.Accept(new SensorUpdateVisitor());
1336-
1337-
foreach (var hardware in computer.Hardware)
1338-
{
1339-
Temps.AddRange(
1340-
from subhardware in hardware.SubHardware
1341-
from sensor in subhardware.Sensors
1342-
where sensor.SensorType.Equals(SensorType.Temperature) && sensor.Value > 24 || sensor.Name.ToLower().Contains("tjmax")
1343-
select new TempMeasurement
1344-
{ Hardware = hardware.Name, SensorName = sensor.Name, SensorValue = sensor.Value.Value }
1345-
);
1346-
1347-
Temps.AddRange(
1348-
from sensor in hardware.Sensors
1349-
where sensor.SensorType.Equals(SensorType.Temperature) && sensor.Value > 24 || sensor.Name.ToLower().Contains("tjmax")
1350-
select new TempMeasurement
1351-
{ Hardware = hardware.Name, SensorName = sensor.Name, SensorValue = sensor.Value.Value }
1352-
);
1353-
}
1354-
}
1355-
catch (OverflowException)
1356-
{
1357-
await LogEventAsync("Absolute value overflow occurred when fetching temperature data", Region.Hardware, EventType.ERROR);
1358-
}
1359-
catch (Exception ex)
1360-
{
1361-
await LogEventAsync($"Exception during temperature measurement: " + ex, Region.Hardware, EventType.ERROR);
1362-
}
1363-
finally
1364-
{
1365-
computer.Close();
1366-
}
1367-
Temperatures = Temps;
1368-
#endif
1369-
}
1370-
13711312
// BATTERIES
13721313
private static async Task GetBatteryData()
13731314
{

client/data/Structs.cs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,6 @@ public SmartAttribute(byte id, string name, string rawValue)
118118
}
119119
}
120120

121-
public class TempMeasurement
122-
{
123-
public string Hardware;
124-
public string SensorName;
125-
public float SensorValue;
126-
}
127-
128121
public class TCPConnection
129122
{
130123
public string LocalIPAddress;
@@ -172,28 +165,6 @@ public class EdidData
172165
public string Checksum; // Byte 127
173166
}
174167

175-
#if !NORING
176-
public class SensorUpdateVisitor : IVisitor
177-
{
178-
public void VisitComputer(IComputer computer)
179-
{
180-
computer.Traverse(this);
181-
}
182-
183-
public void VisitHardware(IHardware hardware)
184-
{
185-
hardware.Update();
186-
foreach (var subHardware in hardware.SubHardware) subHardware.Accept(this);
187-
}
188-
189-
public void VisitSensor(ISensor sensor)
190-
{ }
191-
192-
public void VisitParameter(IParameter parameter)
193-
{ }
194-
}
195-
#endif
196-
197168
public interface IRegistryValue
198169
{ }
199170

client/packages.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<packages>
33
<package id="HidSharp" version="2.1.0" targetFramework="net472" />
44
<package id="ILRepack.Lib.MSBuild.Task" version="2.0.34.1" targetFramework="net472" developmentDependency="true" />
5-
<package id="LibreHardwareMonitorLib" version="0.9.3" targetFramework="net472" />
65
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
76
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
87
<package id="System.CodeDom" version="8.0.0" targetFramework="net472" />

client/specify_client.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@
6262
<PlatformTarget>x64</PlatformTarget>
6363
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
6464
</PropertyGroup>
65-
<ItemGroup Condition=" '$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
66-
<Reference Include="LibreHardwareMonitorLib, Version=0.9.3.0, Culture=neutral, processorArchitecture=MSIL">
67-
<HintPath>packages\LibreHardwareMonitorLib.0.9.3\lib\net472\LibreHardwareMonitorLib.dll</HintPath>
68-
<Private>True</Private>
69-
</Reference>
70-
</ItemGroup>
7165
<ItemGroup>
7266
<Reference Include="HidSharp, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
7367
<HintPath>packages\HidSharp.2.1.0\lib\net35\HidSharp.dll</HintPath>

0 commit comments

Comments
 (0)