@@ -121,8 +121,12 @@ private List<Result> Commands()
121
121
context . API . GetTranslation ( "flowlauncher_plugin_sys_shutdown_computer" ) ,
122
122
MessageBoxButton . YesNo , MessageBoxImage . Warning ) ;
123
123
124
+ // SHTDN_REASON_MAJOR_OTHER indicates a generic shutdown reason that isn't categorized under hardware failure,
125
+ // software updates, or other predefined reasons.
126
+ // SHTDN_REASON_FLAG_PLANNED marks the shutdown as planned rather than an unexpected shutdown or failure
124
127
if ( result == MessageBoxResult . Yes )
125
- PInvoke . ExitWindowsEx ( EXIT_WINDOWS_FLAGS . EWX_SHUTDOWN | EXIT_WINDOWS_FLAGS . EWX_POWEROFF , SHUTDOWN_REASON . SHTDN_REASON_NONE ) ;
128
+ PInvoke . ExitWindowsEx ( EXIT_WINDOWS_FLAGS . EWX_SHUTDOWN | EXIT_WINDOWS_FLAGS . EWX_POWEROFF ,
129
+ SHUTDOWN_REASON . SHTDN_REASON_MAJOR_OTHER | SHUTDOWN_REASON . SHTDN_REASON_FLAG_PLANNED ) ;
126
130
127
131
return true ;
128
132
}
@@ -141,7 +145,8 @@ private List<Result> Commands()
141
145
MessageBoxButton . YesNo , MessageBoxImage . Warning ) ;
142
146
143
147
if ( result == MessageBoxResult . Yes )
144
- PInvoke . ExitWindowsEx ( EXIT_WINDOWS_FLAGS . EWX_REBOOT , SHUTDOWN_REASON . SHTDN_REASON_NONE ) ;
148
+ PInvoke . ExitWindowsEx ( EXIT_WINDOWS_FLAGS . EWX_REBOOT ,
149
+ SHUTDOWN_REASON . SHTDN_REASON_MAJOR_OTHER | SHUTDOWN_REASON . SHTDN_REASON_FLAG_PLANNED ) ;
145
150
146
151
return true ;
147
152
}
@@ -160,7 +165,8 @@ private List<Result> Commands()
160
165
MessageBoxButton . YesNo , MessageBoxImage . Warning ) ;
161
166
162
167
if ( result == MessageBoxResult . Yes )
163
- PInvoke . ExitWindowsEx ( EXIT_WINDOWS_FLAGS . EWX_REBOOT | EXIT_WINDOWS_FLAGS . EWX_BOOTOPTIONS , SHUTDOWN_REASON . SHTDN_REASON_NONE ) ;
168
+ PInvoke . ExitWindowsEx ( EXIT_WINDOWS_FLAGS . EWX_REBOOT | EXIT_WINDOWS_FLAGS . EWX_BOOTOPTIONS ,
169
+ SHUTDOWN_REASON . SHTDN_REASON_MAJOR_OTHER | SHUTDOWN_REASON . SHTDN_REASON_FLAG_PLANNED ) ;
164
170
165
171
return true ;
166
172
}
@@ -179,7 +185,8 @@ private List<Result> Commands()
179
185
MessageBoxButton . YesNo , MessageBoxImage . Warning ) ;
180
186
181
187
if ( result == MessageBoxResult . Yes )
182
- PInvoke . ExitWindowsEx ( EXIT_WINDOWS_FLAGS . EWX_LOGOFF , SHUTDOWN_REASON . SHTDN_REASON_NONE ) ;
188
+ PInvoke . ExitWindowsEx ( EXIT_WINDOWS_FLAGS . EWX_LOGOFF ,
189
+ SHUTDOWN_REASON . SHTDN_REASON_MAJOR_OTHER | SHUTDOWN_REASON . SHTDN_REASON_FLAG_PLANNED ) ;
183
190
184
191
return true ;
185
192
}
0 commit comments