Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / arch / all-mingw32 / bootstrap / shutdown.c
blobff0c607d248f92020bde542acded89deeef0cba4
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 SetCurrentDirectory(bootstrapdir);
20 FillMemory(&runinfo, sizeof(runinfo), 0);
21 runinfo.cb = sizeof(runinfo);
22 /* If we create new process without CREATE_NEW_CONSOLE, strange thing will happen if we start AROS
23 * from within command line processor. Looks like it's Windows bug/misdesign. Well, let's reopen the console every time. */
24 if (CreateProcess(bootstrapname, cmdline, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, bootstrapdir, &runinfo, &ProcInfo)) {
25 D(printf("[Shutdown] AROS re-run\n"));
26 CloseHandle(ProcInfo.hProcess);
27 CloseHandle(ProcInfo.hThread);
28 exit(0);
30 D(printf("[Shutdown] Unable to re-run AROS\n"));