Skip to content

Commit a065179

Browse files
committed
Use PInvoke for const
1 parent 648e3f2 commit a065179

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Plugins/Flow.Launcher.Plugin.Sys/Main.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public class Main : IPlugin, ISettingProvider, IPluginI18n
2222
private PluginInitContext context;
2323
private Dictionary<string, string> KeywordTitleMappings = new Dictionary<string, string>();
2424

25-
private const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege";
2625
// SHTDN_REASON_MAJOR_OTHER indicates a generic shutdown reason that isn't categorized under hardware failure, software updates, or other predefined reasons.
2726
// SHTDN_REASON_FLAG_PLANNED marks the shutdown as planned rather than an unexpected shutdown or failure
2827
private const SHUTDOWN_REASON REASON = SHUTDOWN_REASON.SHTDN_REASON_MAJOR_OTHER | SHUTDOWN_REASON.SHTDN_REASON_FLAG_PLANNED;
@@ -116,7 +115,7 @@ private static unsafe bool EnableShutdownPrivilege()
116115
return false;
117116
}
118117

119-
if (!PInvoke.LookupPrivilegeValue(null, SE_SHUTDOWN_NAME, out var luid))
118+
if (!PInvoke.LookupPrivilegeValue(null, PInvoke.SE_SHUTDOWN_NAME, out var luid))
120119
{
121120
return false;
122121
}

Plugins/Flow.Launcher.Plugin.Sys/NativeMethods.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ OpenProcessToken
88
WIN32_ERROR
99
LookupPrivilegeValue
1010
AdjustTokenPrivileges
11-
TOKEN_PRIVILEGES
11+
TOKEN_PRIVILEGES
12+
SE_SHUTDOWN_NAME

0 commit comments

Comments
 (0)