mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-05 06:15:26 +00:00
Fix AccessDenied in Steam Detection
This commit is contained in:
parent
e52459d02d
commit
76c93c81e5
2 changed files with 10 additions and 16 deletions
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue