Flow-Launcher / Flow-Launcher/Flow.Launcher

BUG: SeShutdownPrivilege required for power state commands

Open Beginner friendly
#4,612 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
15.6k
Forks
644
Avg merge
16h 51m
Merged PRs (30d)
3

Description

Originally posted by @TBM13
>Another detail, suspend/hibernate commands require the `SeShutdownPrivilege` according to Microsoft docs, so `EnableShutdownPrivilege()` should be called like on the shutdown and restart commands

Regarding
https://github.com/Flow-Launcher/Flow.Launcher/blob/dev/Plugins/Flow.Launcher.Plugin.Sys/Main.cs#L316

I can confirm a mention of something similar in micorsoft docs
https://learn.microsoft.com/en-us/windows/win32/api/powrprof/nf-powrprof-setsuspendstate#remarks
> The calling process must have the SE_SHUTDOWN_NAME privilege. To enable the SE_SHUTDOWN_NAME privilege, use the [AdjustTokenPrivileges](https://learn.microsoft.com/en-us/windows/desktop/api/securitybaseapi/nf-securitybaseapi-adjusttokenprivileges) function. For more information, see [Changing Privileges in a Token](https://learn.microsoft.com/en-us/windows/desktop/SecBP/changing-privileges-in-a-token).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in Plugins/Flow.Launcher.Plugin.Sys/Main.cs around line 316 and inspect how shutdown and restart commands call EnableShutdownPrivilege(). Apply the same privilege handling to the suspend and hibernate commands, then verify those power-state commands work on Windows.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.