From 80c0288235fbeb5fd5c71d88d3d10229f713199a Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 23 May 2025 13:24:32 +0800 Subject: [PATCH] Throw exception when editing highest run level task --- Flow.Launcher/Helper/AutoStartup.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/Helper/AutoStartup.cs b/Flow.Launcher/Helper/AutoStartup.cs index 371ab46ef..96578b2fa 100644 --- a/Flow.Launcher/Helper/AutoStartup.cs +++ b/Flow.Launcher/Helper/AutoStartup.cs @@ -78,8 +78,11 @@ public class AutoStartup } else { - // If run level is not correct, we cannot edit it because we are not administrator - if (!runLevelCorrect) + // If run level is not correct or we need to change a highest run level task, + // we cannot edit it because we are not administrator + // So we just throw an exception to let the user know + if (!runLevelCorrect || // run level is not correct + alwaysRunAsAdministrator) // we need to change a highest run level task { throw new UnauthorizedAccessException("Cannot edit task run level because the app is not running as administrator."); }