Use PInvoke for const

This commit is contained in:
Jack251970 2025-02-18 11:12:33 +08:00
parent 648e3f2689
commit a065179d53
2 changed files with 3 additions and 3 deletions

View file

@ -22,7 +22,6 @@ namespace Flow.Launcher.Plugin.Sys
private PluginInitContext context;
private Dictionary<string, string> KeywordTitleMappings = new Dictionary<string, string>();
private const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege";
// SHTDN_REASON_MAJOR_OTHER indicates a generic shutdown reason that isn't categorized under hardware failure, software updates, or other predefined reasons.
// SHTDN_REASON_FLAG_PLANNED marks the shutdown as planned rather than an unexpected shutdown or failure
private const SHUTDOWN_REASON REASON = SHUTDOWN_REASON.SHTDN_REASON_MAJOR_OTHER | SHUTDOWN_REASON.SHTDN_REASON_FLAG_PLANNED;
@ -116,7 +115,7 @@ namespace Flow.Launcher.Plugin.Sys
return false;
}
if (!PInvoke.LookupPrivilegeValue(null, SE_SHUTDOWN_NAME, out var luid))
if (!PInvoke.LookupPrivilegeValue(null, PInvoke.SE_SHUTDOWN_NAME, out var luid))
{
return false;
}

View file

@ -8,4 +8,5 @@ OpenProcessToken
WIN32_ERROR
LookupPrivilegeValue
AdjustTokenPrivileges
TOKEN_PRIVILEGES
TOKEN_PRIVILEGES
SE_SHUTDOWN_NAME