Skip to content

Commit

Permalink
Fixed an issue causing a crash when HidHide couldn't start it's backu…
Browse files Browse the repository at this point in the history
…p process
  • Loading branch information
Valkirie committed Aug 10, 2024
1 parent cec7de5 commit 71fbf68
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions HandheldCompanion/Misc/HidHide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ public static bool UnregisterApplication(string fileName)
return false;

process.StartInfo.Arguments = $"--app-unreg \"{fileName}\"";
process.Start();
bool started = process.Start();
bool success = process.WaitForExit(TimeSpan.FromSeconds(3));

if (success)
if (started && success)
{
process.StandardOutput.ReadToEnd(); // todo: parse result
LogManager.LogInformation("HideDevice RemoveApplicationPath: {0}", fileName);
Expand Down Expand Up @@ -144,10 +144,10 @@ public static bool RegisterApplication(string fileName)
return false;

process.StartInfo.Arguments = $"--app-reg \"{fileName}\"";
process.Start();
bool started = process.Start();
bool success = process.WaitForExit(TimeSpan.FromSeconds(3));

if (success)
if (started && success)
{
process.StandardOutput.ReadToEnd(); // todo: parse result
LogManager.LogInformation("HideDevice AddApplicationPath: {0}", fileName);
Expand Down Expand Up @@ -183,10 +183,10 @@ public static bool SetCloaking(bool status)
process.StartInfo.Arguments = $"--cloak-off";
break;
}
process.Start();
bool started = process.Start();
bool success = process.WaitForExit(TimeSpan.FromSeconds(3));

if (success)
if (started && success)
{
process.StandardOutput.ReadToEnd(); // todo: parse result
LogManager.LogInformation("HideDevice SetCloaking: {0}", status);
Expand Down Expand Up @@ -218,10 +218,10 @@ public static bool UnhidePath(string deviceInstancePath)
return false;

process.StartInfo.Arguments = $"--dev-unhide \"{deviceInstancePath}\"";
process.Start();
bool started = process.Start();
bool success = process.WaitForExit(TimeSpan.FromSeconds(3));

if (success)
if (started && success)
{
process.StandardOutput.ReadToEnd(); // todo: parse result
LogManager.LogInformation("HideDevice AddBlockedInstanceId: {0}", deviceInstancePath);
Expand Down Expand Up @@ -253,10 +253,10 @@ public static bool HidePath(string deviceInstancePath)
return false;

process.StartInfo.Arguments = $"--dev-hide \"{deviceInstancePath}\"";
process.Start();
bool started = process.Start();
bool success = process.WaitForExit(TimeSpan.FromSeconds(3));

if (success)
if (started && success)
{
process.StandardOutput.ReadToEnd(); // todo: parse result
LogManager.LogInformation("HideDevice AddBlockedInstanceId: {0}", deviceInstancePath);
Expand All @@ -275,10 +275,10 @@ public static List<HidHideDevice> GetHidHideDevices(string arg = "--dev-all")

// using --dev-gaming sometimes doesn't report controllers or have empty BaseContainerDeviceInstancePath
process.StartInfo.Arguments = $"--dev-all";
process.Start();
bool started = process.Start();
bool success = process.WaitForExit(TimeSpan.FromSeconds(3));

if (success)
if (started && success)
{
string jsonString = process.StandardOutput.ReadToEnd().Trim();
if (string.IsNullOrEmpty(jsonString))
Expand Down

0 comments on commit 71fbf68

Please sign in to comment.