Skip to content

Commit ffa3038

Browse files
committed
Replace process commands with PInvoke
1 parent 827b6ed commit ffa3038

File tree

1 file changed

+4
-4
lines changed
  • Plugins/Flow.Launcher.Plugin.Sys

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private List<Result> Commands()
122122
MessageBoxButton.YesNo, MessageBoxImage.Warning);
123123

124124
if (result == MessageBoxResult.Yes)
125-
Process.Start("shutdown", "/s /t 0");
125+
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_SHUTDOWN | EXIT_WINDOWS_FLAGS.EWX_POWEROFF, SHUTDOWN_REASON.SHTDN_REASON_NONE);
126126

127127
return true;
128128
}
@@ -141,7 +141,7 @@ private List<Result> Commands()
141141
MessageBoxButton.YesNo, MessageBoxImage.Warning);
142142

143143
if (result == MessageBoxResult.Yes)
144-
Process.Start("shutdown", "/r /t 0");
144+
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_REBOOT, SHUTDOWN_REASON.SHTDN_REASON_NONE);
145145

146146
return true;
147147
}
@@ -160,7 +160,7 @@ private List<Result> Commands()
160160
MessageBoxButton.YesNo, MessageBoxImage.Warning);
161161

162162
if (result == MessageBoxResult.Yes)
163-
Process.Start("shutdown", "/r /o /t 0");
163+
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_REBOOT | EXIT_WINDOWS_FLAGS.EWX_BOOTOPTIONS, SHUTDOWN_REASON.SHTDN_REASON_NONE);
164164

165165
return true;
166166
}
@@ -179,7 +179,7 @@ private List<Result> Commands()
179179
MessageBoxButton.YesNo, MessageBoxImage.Warning);
180180

181181
if (result == MessageBoxResult.Yes)
182-
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_LOGOFF, 0);
182+
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_LOGOFF, SHUTDOWN_REASON.SHTDN_REASON_NONE);
183183

184184
return true;
185185
}

0 commit comments

Comments
 (0)