Skip to content

Commit e94018d

Browse files
coldaysPhyxionNL
andauthored
Add option to disable Ring0 driver installation (#1777)
* Add option to disable Ring0 driver installation * Update Computer.cs --------- Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
1 parent f8b198a commit e94018d

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

LibreHardwareMonitorLib/Hardware/Computer.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class Computer : IComputer
4646
private bool _psuEnabled;
4747
private SMBios _smbios;
4848
private bool _storageEnabled;
49+
private bool _ring0Enabled = true;
4950

5051
/// <summary>
5152
/// Creates a new <see cref="IComputer" /> instance with basic initial <see cref="Settings" />.
@@ -279,6 +280,16 @@ public bool IsStorageEnabled
279280
}
280281
}
281282

283+
/// <inheritdoc />
284+
public bool IsRing0Enabled
285+
{
286+
get { return _ring0Enabled; }
287+
set
288+
{
289+
_ring0Enabled = value;
290+
}
291+
}
292+
282293
/// <summary>
283294
/// Contains computer information table read in accordance with <see href="https://www.dmtf.org/standards/smbios">System Management BIOS (SMBIOS) Reference Specification</see>.
284295
/// </summary>
@@ -489,7 +500,9 @@ public void Open()
489500

490501
_smbios = new SMBios();
491502

492-
Ring0.Open();
503+
if (IsRing0Enabled)
504+
Ring0.Open();
505+
493506
Mutexes.Open();
494507
OpCode.Open();
495508

LibreHardwareMonitorLib/Hardware/IComputer.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,16 @@ public interface IComputer : IElement
108108
/// <returns><see langword="true" /> if a given category of devices is already enabled.</returns>
109109
bool IsStorageEnabled { get; }
110110

111+
/// <summary>
112+
/// Gets or sets a value indicating whether the Ring0 driver should be installed if user privileges is sufficient.
113+
/// </summary>
114+
/// <returns><see langword="true" /> if Ring0 driver installation is enabled</returns>
115+
/// <remarks>Default value is <see langword="true" />. Only affects Windows.</remarks>
116+
bool IsRing0Enabled { get; }
117+
111118
/// <summary>
112119
/// Generates full LibreHardwareMonitor report for devices that have been enabled.
113120
/// </summary>
114121
/// <returns>A formatted text string with library, OS and hardware information.</returns>
115122
string GetReport();
116-
}
123+
}

0 commit comments

Comments
 (0)