Forward MUIM_Notify, MUIM_KillNotify and MUIM_KillNotifyObj from a listview
[AROS.git] / arch / all-mingw32 / bootstrap / shutdown.c
blob5cfcd142e04b917a8d81f235f2818618318a3159
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <stdio.h>
7 #include <windows.h>
9 #include "hostlib.h"
10 #include "sharedmem.h"
11 #include "shutdown.h"
12 #include "unicode.h"
14 #define D(x)
16 char *bootstrapname;
17 static LPTSTR cmdline;
19 /* Remember our launch context (bootstrap name and command line) */
20 void SaveArgs(char **argv)
22 bootstrapname = argv[0];
23 cmdline = GetCommandLine();
26 void __aros Host_Shutdown(unsigned char warm)
28 LPTSTR bsname;
29 BOOL res;
30 STARTUPINFO runinfo;
31 PROCESS_INFORMATION ProcInfo;
32 char var[SHARED_RAM_LEN];
34 if (warm)
35 sprintf(var, "%s=%p:%p", SHARED_RAM_VAR, RAM_Handle, RAM_Address);
36 else
37 strcpy(var, SHARED_RAM_VAR "=");
39 D(printf("[Shutdown] Dir: %s, Name: %s, RAM: %s, Command line: %s\n", bootstrapdir, bootstrapname, var, cmdline));
40 putenv(var);
41 SetCurrentDirectory(bootstrapdir);
42 FillMemory(&runinfo, sizeof(runinfo), 0);
43 runinfo.cb = sizeof(runinfo);
45 bsname = StrConvert(bootstrapname);
47 * If we create new process without CREATE_NEW_CONSOLE, strange thing will happen if we start AROS
48 * from within command line processor. Looks like it's Windows bug/misdesign. Well, let's reopen the console every time.
50 res = CreateProcess(bsname, cmdline, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, bootstrapdir, &runinfo, &ProcInfo);
51 StrFree(bsname);
53 if (res)
55 D(printf("[Shutdown] AROS re-run\n"));
57 CloseHandle(ProcInfo.hProcess);
58 CloseHandle(ProcInfo.hThread);
59 exit(0);
62 D(printf("[Shutdown] Unable to re-run AROS\n"));