From 6522db0065b352709cc06b49d06515e4a2b7be70 Mon Sep 17 00:00:00 2001 From: sonic Date: Wed, 21 Dec 2011 08:03:34 +0000 Subject: [PATCH] Some (incomplete) adaptations to WinCE git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@43131 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- arch/all-mingw32/bootstrap/memory.c | 7 ++++--- arch/all-mingw32/bootstrap/shutdown.c | 29 ++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/arch/all-mingw32/bootstrap/memory.c b/arch/all-mingw32/bootstrap/memory.c index edee892077..e8a9907e2c 100644 --- a/arch/all-mingw32/bootstrap/memory.c +++ b/arch/all-mingw32/bootstrap/memory.c @@ -39,10 +39,10 @@ void *AllocateRW(size_t len) void *AllocateRAM(size_t len) { void *addr = NULL; - char *var; SECURITY_ATTRIBUTES sa; +#ifndef UNDER_CE + const char *var = getenv(SHARED_RAM_VAR); - var = getenv(SHARED_RAM_VAR); if (var) { D(printf("[AllocateRAM] Found RAM specification: %s\n", var)); @@ -52,8 +52,9 @@ void *AllocateRAM(size_t len) addr = NULL; } } - D(printf("[AllocateRAM] Inherited memory handle 0x%p address 0x%p\n", RAM_Handle, addr)); +#endif + if (!RAM_Handle) { sa.nLength = sizeof(sa); diff --git a/arch/all-mingw32/bootstrap/shutdown.c b/arch/all-mingw32/bootstrap/shutdown.c index 33524fa0a0..47dcd550e0 100644 --- a/arch/all-mingw32/bootstrap/shutdown.c +++ b/arch/all-mingw32/bootstrap/shutdown.c @@ -7,41 +7,52 @@ #define D(x) -static char *bootstrapname; -static char *cmdline; +/* Windows CE has no notion of "current directory" */ +#ifdef UNDER_CE +#define bootstrapdir NULL +#endif + +static LPTSTR bootstrapname; +static LPTSTR cmdline; void SaveArgs(char **argv) { + /* FIXME: Adapt to WinCE by converting argv[0] to Unicode */ bootstrapname = argv[0]; cmdline = GetCommandLine(); } void __aros Host_Shutdown(unsigned char warm) { - char var[SHARED_RAM_LEN]; STARTUPINFO runinfo; PROCESS_INFORMATION ProcInfo; +#ifndef UNDER_CE + char var[SHARED_RAM_LEN]; if (warm) - sprintf(var, "%s=%p:%p", SHARED_RAM_VAR, RAM_Handle, RAM_Address); + sprintf(var, "%s=%p:%p", SHARED_RAM_VAR, RAM_Handle, RAM_Address); else - strcpy(var, SHARED_RAM_VAR "="); + strcpy(var, SHARED_RAM_VAR "="); D(printf("[Shutdown] Dir: %s, Name: %s, RAM: %s, Command line: %s\n", bootstrapdir, bootstrapname, var, cmdline)); putenv(var); SetCurrentDirectory(bootstrapdir); +#endif FillMemory(&runinfo, sizeof(runinfo), 0); runinfo.cb = sizeof(runinfo); - /* If we create new process without CREATE_NEW_CONSOLE, strange thing will happen if we start AROS - * from within command line processor. Looks like it's Windows bug/misdesign. Well, let's reopen the console every time. */ + /* + * If we create new process without CREATE_NEW_CONSOLE, strange thing will happen if we start AROS + * from within command line processor. Looks like it's Windows bug/misdesign. Well, let's reopen the console every time. + */ if (CreateProcess(bootstrapname, cmdline, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, bootstrapdir, &runinfo, &ProcInfo)) { - D(printf("[Shutdown] AROS re-run\n")); + D(printf("[Shutdown] AROS re-run\n")); + CloseHandle(ProcInfo.hProcess); CloseHandle(ProcInfo.hThread); exit(0); } + D(printf("[Shutdown] Unable to re-run AROS\n")); } - -- 2.11.4.GIT