Fix AccessDenied in Steam Detection

This commit is contained in:
Kamil Trzciński 2022-11-28 11:11:30 +01:00
parent e52459d02d
commit 76c93c81e5
2 changed files with 10 additions and 16 deletions

View file

@ -29,3 +29,4 @@ It does help this project on being supported.
- Append `controller_blacklist` to `config.vdf` if missing
- Add configurable BackPanel keys (allowed mappings are subject to change)
- Fix delay in X360Rumble: Do not send repeated haptic if disabled
- Fix `AccessDenied` in Steam Detection

View file

@ -27,17 +27,8 @@ namespace SteamController.Helpers
var value = GetValue<int>(ActiveProcessKey, PIDValue);
if (value is null)
return null;
try
{
using (var process = Process.GetProcessById(value.Value))
{
return !process.HasExited;
}
}
catch (ArgumentException)
{
return false;
}
using (var process = SteamProcess)
return process is not null;
}
}
@ -102,12 +93,14 @@ namespace SteamController.Helpers
return null;
try
{
return Process.GetProcessById(value.Value);
}
catch (ArgumentException)
{
return null;
var process = Process.GetProcessById(value.Value);
if (!process.ProcessName.Equals("Steam", StringComparison.CurrentCultureIgnoreCase))
return null;
if (process.HasExited)
return null;
return process;
}
catch { return null; }
}
}