From 905e75f8e98b951a368252f272773142ea15d9af Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 18 Aug 2004 21:03:32 +0000 Subject: [PATCH] The argv array passed to the app needs to be in the Ansi codepage, not the Unix one. --- dlls/kernel/process.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c index 0f457fd1f9..284983e792 100644 --- a/dlls/kernel/process.c +++ b/dlls/kernel/process.c @@ -489,6 +489,7 @@ static void set_registry_environment(void) static void set_library_wargv( char **argv ) { int argc; + char *q; WCHAR *p; WCHAR **wargv; DWORD total = 0; @@ -507,6 +508,24 @@ static void set_library_wargv( char **argv ) total -= reslen; } wargv[argc] = NULL; + + /* convert argv back from Unicode since it has to be in the Ansi codepage not the Unix one */ + + for (argc = 0; wargv[argc]; argc++) + total += WideCharToMultiByte( CP_ACP, 0, wargv[argc], -1, NULL, 0, NULL, NULL ); + + argv = RtlAllocateHeap( GetProcessHeap(), 0, total + (argc + 1) * sizeof(*argv) ); + q = (char *)(argv + argc + 1); + for (argc = 0; wargv[argc]; argc++) + { + DWORD reslen = WideCharToMultiByte( CP_ACP, 0, wargv[argc], -1, q, total, NULL, NULL ); + argv[argc] = q; + q += reslen; + total -= reslen; + } + argv[argc] = NULL; + + __wine_main_argv = argv; __wine_main_wargv = wargv; } -- 2.32.0.93.g670b81a890