Fixes #1889
This commit is contained in:
@@ -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,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()
|
||||
|
||||
Reference in New Issue
Block a user