Re-enabled use of AROS.Boot file due to lack of general enthusiasm for
[tangerine.git] / arch / all-mingw32 / bootstrap / shutdown.c
blobb0c732e7daa6e31efb73ae3bd677afb9b28a5cc3
1 #include <stdlib.h>
2 #include <windows.h>
3 #include "shutdown.h"
5 #define D(x)
7 void Host_Shutdown(unsigned long action)
9 STARTUPINFO runinfo;
10 PROCESS_INFORMATION ProcInfo;
12 switch (action) {
13 case SD_ACTION_POWEROFF:
14 D(printf("[Shutdown] POWER OFF request\n"));
15 exit(0);
16 break;
17 case SD_ACTION_COLDREBOOT:
18 D(printf("[Shutdown] Cold reboot, dir: %s, name: %s, command line: %s\n", bootstrapdir, bootstrapname, cmdline));
19 FillMemory(&runinfo, sizeof(runinfo), 0);
20 runinfo.cb = sizeof(runinfo);
21 /* If we create new process without CREATE_NEW_CONSOLE, strange thing will happen if we start AROS
22 * from within command line processor. Looks like it's Windows bug/misdesign. Well, let's reopen the console every time. */
23 if (CreateProcess(bootstrapname, cmdline, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, bootstrapdir, &runinfo, &ProcInfo)) {
24 D(printf("[Shutdown] AROS re-run\n"));
25 CloseHandle(ProcInfo.hProcess);
26 CloseHandle(ProcInfo.hThread);
27 exit(0);
29 D(printf("[Shutdown] Unable to re-run AROS\n"));