Skip to content

Commit 80c0288

Browse files
committed
Throw exception when editing highest run level task
1 parent c3ec002 commit 80c0288

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Flow.Launcher/Helper/AutoStartup.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ private static bool CheckLogonTask(bool alwaysRunAsAdministrator)
7878
}
7979
else
8080
{
81-
// If run level is not correct, we cannot edit it because we are not administrator
82-
if (!runLevelCorrect)
81+
// If run level is not correct or we need to change a highest run level task,
82+
// we cannot edit it because we are not administrator
83+
// So we just throw an exception to let the user know
84+
if (!runLevelCorrect || // run level is not correct
85+
alwaysRunAsAdministrator) // we need to change a highest run level task
8386
{
8487
throw new UnauthorizedAccessException("Cannot edit task run level because the app is not running as administrator.");
8588
}

0 commit comments

Comments
 (0)