190{
193
194
196
198 {
201 }
202
205 {
208 }
209
210
211 if (opts.abort)
212 {
213
214
215 if (opts.remote_system ==
NULL)
217 else
219
220
222 {
226 }
227 else
228 {
230 }
231 }
232
233
234
235
236
237
238 if (opts.hibernate)
239 {
241 {
243
244
245 if (opts.remote_system !=
NULL)
246 {
248 }
249
251 {
255 }
256 else
257 {
260 }
261 }
262 else
263 {
265 }
266 }
267
268
269 if (opts.shutdown && opts.restart)
270 {
273 }
274
275
277 {
280 }
281
282
283 if (opts.show_gui)
284 {
287 else
289 }
290
291 if (opts.logoff && (opts.remote_system ==
NULL))
292 {
293
294
295
296
297
298
299 if (!opts.shutdown && !opts.restart)
300 {
302
304 {
306 }
307 else
308 {
312 }
313 }
314 }
315
316
317
318
319
320 if (opts.shutdown || opts.restart)
321 {
322
323
324
325
326 if (opts.remote_system ==
NULL)
327 {
329 }
330 else
331 {
332
333
335 }
336
337
339 opts.message,
340 opts.shutdown_delay,
341 opts.force,
342 opts.restart,
343 opts.reason))
344 {
345
346
347
348
349 if (opts.restart)
351 else
353
356 }
357 else
358 {
360 }
361 }
362
364}
BOOL ShutdownGuiMain(struct CommandLineOptions opts)
#define IDS_ERROR_SHUTDOWN_REBOOT
#define IDS_ERROR_HIBERNATE_ENABLED
#define IDS_ERROR_HIBERNATE
#define IDS_ERROR_SHUTDOWN
#define IDS_ERROR_RESTART
#define IDS_ERROR_TIMEOUT
static DWORD EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
static DWORD ParseArguments(struct CommandLineOptions *pOpts, int argc, WCHAR *argv[])
#define ConInitStdStreams()
void ConResPrintf(FILE *fp, UINT nID,...)
BOOL WINAPI AbortSystemShutdownW(LPCWSTR lpMachineName)
BOOL WINAPI InitiateSystemShutdownExW(LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown, DWORD dwReason)
BOOLEAN WINAPI IsPwrHibernateAllowed(VOID)
BOOLEAN WINAPI SetSuspendState(BOOLEAN Hibernate, BOOLEAN ForceCritical, BOOLEAN DisableWakeEvent)
#define SE_REMOTE_SHUTDOWN_NAME
#define MAX_SHUTDOWN_TIMEOUT
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)