This commit is contained in:
PhyxionNL
2025-09-27 12:54:24 +02:00
parent 3023089017
commit 79a043e5bf
3 changed files with 25 additions and 3 deletions
+11 -1
View File
@@ -1,4 +1,6 @@
using System;
using System.Security.AccessControl;
using System.Security.Principal;
using System.Threading;
namespace LibreHardwareMonitor.Hardware;
@@ -24,7 +26,15 @@ internal static class Mutexes
{
try
{
return new Mutex(false, name);
var worldRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl, AccessControlType.Allow);
var mutexSecurity = new MutexSecurity();
mutexSecurity.AddAccessRule(worldRule);
#if NETFRAMEWORK
return new Mutex(false, name, out _, mutexSecurity);
#else
return MutexAcl.Create(false, name, out _, mutexSecurity);
#endif
}
catch (UnauthorizedAccessException)
{
@@ -50,6 +50,7 @@
<PackageReference Include="HidSharp" Version="2.6.2" />
<PackageReference Include="RAMSPDToolkit-NDD" Version="1.3.2" />
<PackageReference Include="System.Management" Version="9.0.9" />
<PackageReference Include="System.Threading.AccessControl" Version="9.0.9" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\packageicon.png" PackagePath="">
+13 -2
View File
@@ -13,6 +13,7 @@ public class RyzenSmu
throw new TimeoutException("Timeout waiting for PCI bus mutex");
uint version;
try
{
long[] outArray = _pawnIO.Execute("ioctl_get_smu_version", [], 1);
@@ -34,8 +35,18 @@ public class RyzenSmu
public long[] ReadPmTable(int size)
{
long[] outArray = _pawnIO.Execute("ioctl_read_pm_table", [], size);
return outArray;
if (!Mutexes.WaitPciBus(5000))
throw new TimeoutException("Timeout waiting for PCI bus mutex");
try
{
long[] outArray = _pawnIO.Execute("ioctl_read_pm_table", [], size);
return outArray;
}
finally
{
Mutexes.ReleasePciBus();
}
}
public void UpdatePmTable()