mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Check run level
This commit is contained in:
parent
902c8f4412
commit
c5c24acb17
1 changed files with 7 additions and 1 deletions
|
|
@ -64,7 +64,8 @@ public class AutoStartup
|
|||
if (task.Definition.Actions.FirstOrDefault() is Microsoft.Win32.TaskScheduler.Action taskAction)
|
||||
{
|
||||
var action = taskAction.ToString().Trim();
|
||||
if (!action.Equals(Constant.ExecutablePath, StringComparison.OrdinalIgnoreCase))
|
||||
if (!action.Equals(Constant.ExecutablePath, StringComparison.OrdinalIgnoreCase) || // Path issue
|
||||
!CheckRunLevel(task.Definition.Principal, alwaysRunAsAdministrator)) // Run level issue
|
||||
{
|
||||
UnscheduleLogonTask();
|
||||
ScheduleLogonTask(alwaysRunAsAdministrator);
|
||||
|
|
@ -83,6 +84,11 @@ public class AutoStartup
|
|||
return false;
|
||||
}
|
||||
|
||||
private static bool CheckRunLevel(TaskPrincipal tp, bool alwaysRunAsAdministrator)
|
||||
{
|
||||
return alwaysRunAsAdministrator ? tp.RunLevel == TaskRunLevel.Highest : tp.RunLevel != TaskRunLevel.Highest;
|
||||
}
|
||||
|
||||
private static bool CheckRegistry()
|
||||
{
|
||||
try
|
||||
|
|
|
|||
Loading…
Reference in a new issue