Skip to content

Commit

Permalink
Merge pull request #2149 from ngtr6788/windows-settings-elevation
Browse files Browse the repository at this point in the history
Fix: Add admin permissions when non-admin doesn't work
  • Loading branch information
taooceros authored May 26, 2023
2 parents 31d80fe + 6cc5fe8 commit 4144829
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
Expand Down Expand Up @@ -201,6 +202,21 @@ private static bool DoOpenSettingsAction(WindowsSetting entry)
Process.Start(processStartInfo);
return true;
}
catch (Win32Exception)
{
try
{
processStartInfo.UseShellExecute = true;
processStartInfo.Verb = "runas";
Process.Start(processStartInfo);
return true;
}
catch (Exception exception)
{
Log.Exception("can't open settings on elevated permission", exception, typeof(ResultHelper));
return false;
}
}
catch (Exception exception)
{
Log.Exception("can't open settings", exception, typeof(ResultHelper));
Expand Down

0 comments on commit 4144829

Please sign in to comment.