From e94018d7d594047ad64279e0ae40e6c3c55b5d7c Mon Sep 17 00:00:00 2001 From: coldays <9074700+coldays@users.noreply.github.com> Date: Wed, 9 Jul 2025 23:24:57 +0200 Subject: [PATCH] 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> --- LibreHardwareMonitorLib/Hardware/Computer.cs | 15 ++++++++++++++- LibreHardwareMonitorLib/Hardware/IComputer.cs | 9 ++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/LibreHardwareMonitorLib/Hardware/Computer.cs b/LibreHardwareMonitorLib/Hardware/Computer.cs index df0a803..517a978 100644 --- a/LibreHardwareMonitorLib/Hardware/Computer.cs +++ b/LibreHardwareMonitorLib/Hardware/Computer.cs @@ -46,6 +46,7 @@ public class Computer : IComputer private bool _psuEnabled; private SMBios _smbios; private bool _storageEnabled; + private bool _ring0Enabled = true; /// /// Creates a new instance with basic initial . @@ -279,6 +280,16 @@ public class Computer : IComputer } } + /// + public bool IsRing0Enabled + { + get { return _ring0Enabled; } + set + { + _ring0Enabled = value; + } + } + /// /// Contains computer information table read in accordance with System Management BIOS (SMBIOS) Reference Specification. /// @@ -489,7 +500,9 @@ public class Computer : IComputer _smbios = new SMBios(); - Ring0.Open(); + if (IsRing0Enabled) + Ring0.Open(); + Mutexes.Open(); OpCode.Open(); diff --git a/LibreHardwareMonitorLib/Hardware/IComputer.cs b/LibreHardwareMonitorLib/Hardware/IComputer.cs index 2c43a41..8ea1dc8 100644 --- a/LibreHardwareMonitorLib/Hardware/IComputer.cs +++ b/LibreHardwareMonitorLib/Hardware/IComputer.cs @@ -108,9 +108,16 @@ public interface IComputer : IElement /// if a given category of devices is already enabled. bool IsStorageEnabled { get; } + /// + /// Gets or sets a value indicating whether the Ring0 driver should be installed if user privileges is sufficient. + /// + /// if Ring0 driver installation is enabled + /// Default value is . Only affects Windows. + bool IsRing0Enabled { get; } + /// /// Generates full LibreHardwareMonitor report for devices that have been enabled. /// /// A formatted text string with library, OS and hardware information. string GetReport(); -} \ No newline at end of file +}