From ce40587ef4b68285da7bdad51f39d46a4011a841 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 7 Jul 2014 23:43:30 +0200 Subject: [PATCH] Return NULL-terminated list of arguments in CommandLineToArgvW. --- README.md | 1 + debian/changelog | 1 + ...ULL-terminated-list-of-arguments-in-.patch | 97 +++++++++++++++++++ .../808eee8b-cf10-49e3-a4a0-3272e4c139c3.def | 3 + patches/patch-list.patch | 3 +- 5 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 patches/17-shell32/0001-shell32-Return-NULL-terminated-list-of-arguments-in-.patch create mode 100644 patches/17-shell32/808eee8b-cf10-49e3-a4a0-3272e4c139c3.def diff --git a/README.md b/README.md index 8cb3db13..a9b6d4fb 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Current patches include: * Implement an Arial replacement font (http://bugs.winehq.org/show_bug.cgi?id=32323) * Workaround for TransactNamedPipe not being supported (http://bugs.winehq.org/show_bug.cgi?id=17273) * Fix incorrect scaling for DECIMAL values in VarDecAdd (http://bugs.winehq.org/show_bug.cgi?id=31269) +* Return NULL-terminated list of arguments in CommandLineToArgvW (http://bugs.winehq.org/show_bug.cgi?id=22829) * XEMBED support for embedding Wine windows inside Linux applications * Reduced SetTimer minimum value from 15 ms to 5 ms (improves Silverlight framerates) * Lockfree algorithm for filedescriptor cache (improves file access speed) diff --git a/debian/changelog b/debian/changelog index c83051a3..8d68cee7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ wine-compholio (1.7.22) UNRELEASED; urgency=low * Updated RegSetKeySecurity patch to work with special root keys. * Add patch for wtsapi32.WTSEnumerateProcessesW function. * Fix incorrect scaling for DECIMAL values in VarDecAdd. + * Return NULL-terminated list of arguments in CommandLineToArgvW. -- Erich E. Hoover Fri, 04 Jul 2014 13:18:40 -0600 wine-compholio (1.7.21) unstable; urgency=low diff --git a/patches/17-shell32/0001-shell32-Return-NULL-terminated-list-of-arguments-in-.patch b/patches/17-shell32/0001-shell32-Return-NULL-terminated-list-of-arguments-in-.patch new file mode 100644 index 00000000..8ec474e9 --- /dev/null +++ b/patches/17-shell32/0001-shell32-Return-NULL-terminated-list-of-arguments-in-.patch @@ -0,0 +1,97 @@ +From 93f4119c240a38fbd7108674d766e12998dbb081 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Mon, 7 Jul 2014 22:43:01 +0200 +Subject: shell32: Return NULL-terminated list of arguments in + CommandLineToArgvW. + +--- + dlls/shell32/shell32_main.c | 15 +++++++++------ + dlls/shell32/tests/shlexec.c | 4 ++++ + 2 files changed, 13 insertions(+), 6 deletions(-) + +diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c +index 679ebec..3bf442e 100644 +--- a/dlls/shell32/shell32_main.c ++++ b/dlls/shell32/shell32_main.c +@@ -101,11 +101,11 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs) + /* Return the path to the executable */ + DWORD len, deslen=MAX_PATH, size; + +- size = sizeof(LPWSTR) + deslen*sizeof(WCHAR) + sizeof(LPWSTR); ++ size = sizeof(LPWSTR)*2 + deslen*sizeof(WCHAR); + for (;;) + { + if (!(argv = LocalAlloc(LMEM_FIXED, size))) return NULL; +- len = GetModuleFileNameW(0, (LPWSTR)(argv+1), deslen); ++ len = GetModuleFileNameW(0, (LPWSTR)(argv+2), deslen); + if (!len) + { + LocalFree(argv); +@@ -113,10 +113,11 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs) + } + if (len < deslen) break; + deslen*=2; +- size = sizeof(LPWSTR) + deslen*sizeof(WCHAR) + sizeof(LPWSTR); ++ size = sizeof(LPWSTR)*2 + deslen*sizeof(WCHAR); + LocalFree( argv ); + } +- argv[0]=(LPWSTR)(argv+1); ++ argv[0]=(LPWSTR)(argv+2); ++ argv[1]=NULL; + *numargs=1; + + return argv; +@@ -194,10 +195,10 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs) + * with it. This way the caller can make a single LocalFree() call to free + * both, as per MSDN. + */ +- argv=LocalAlloc(LMEM_FIXED, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR)); ++ argv=LocalAlloc(LMEM_FIXED, (argc+1)*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR)); + if (!argv) + return NULL; +- cmdline=(LPWSTR)(argv+argc); ++ cmdline=(LPWSTR)(argv+argc+1); + strcpyW(cmdline, lpCmdline); + + /* --- Then split and copy the arguments */ +@@ -235,6 +236,7 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs) + if (!*s) + { + /* There are no parameters so we are all done */ ++ argv[argc]=NULL; + *numargs=argc; + return argv; + } +@@ -306,6 +308,7 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs) + } + } + *d='\0'; ++ argv[argc]=NULL; + *numargs=argc; + + return argv; +diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c +index 7f07c70..f81794e 100644 +--- a/dlls/shell32/tests/shlexec.c ++++ b/dlls/shell32/tests/shlexec.c +@@ -1159,6 +1159,8 @@ static BOOL test_one_cmdline(const cmdline_tests_t* test) + win_skip("CommandLineToArgvW not implemented, skipping\n"); + return FALSE; + } ++ ok(!argsW[cl2a_count] || broken(argsW[cl2a_count] != NULL) /* before Vista */, ++ "expected NULL-terminated list of commandline arguments\n"); + + count = 0; + while (test->args[count]) +@@ -1218,6 +1220,8 @@ static void test_commandline2argv(void) + *strW = 0; + args = CommandLineToArgvW(strW, &numargs); + ok(numargs == 1, "expected 1 args, got %d\n", numargs); ++ ok(!args || (!args[numargs] || broken(args[numargs] != NULL) /* before Vista */), ++ "expected NULL-terminated list of commandline arguments\n"); + if (numargs == 1) + { + GetModuleFileNameW(NULL, strW, sizeof(strW)/sizeof(*strW)); +-- +1.7.9.5 + diff --git a/patches/17-shell32/808eee8b-cf10-49e3-a4a0-3272e4c139c3.def b/patches/17-shell32/808eee8b-cf10-49e3-a4a0-3272e4c139c3.def new file mode 100644 index 00000000..ad3162aa --- /dev/null +++ b/patches/17-shell32/808eee8b-cf10-49e3-a4a0-3272e4c139c3.def @@ -0,0 +1,3 @@ +Revision: 1 +Author: Sebastian Lackner +Title: Return NULL-terminated list of arguments in CommandLineToArgvW. diff --git a/patches/patch-list.patch b/patches/patch-list.patch index 983664bd..88adaed4 100644 --- a/patches/patch-list.patch +++ b/patches/patch-list.patch @@ -6,7 +6,7 @@ diff --git a/libs/wine/config.c b/libs/wine/config.c index a273502..5fa0cd5 100644 --- a/libs/wine/config.c +++ b/libs/wine/config.c -@@ -478,6 +478,44 @@ const char *wine_get_version(void) +@@ -478,6 +478,45 @@ const char *wine_get_version(void) return PACKAGE_VERSION; } @@ -32,6 +32,7 @@ index a273502..5fa0cd5 100644 + { "e46b26df-3c1b-419c-9579-f0d1e1c50bea:1", "Sebastian Lackner", "Workaround for broken implementation of shlwapi url functions." }, + { "3790a2d5-f930-423e-9c03-f7fc1c1e0811:1", "Sebastian Lackner", "Partial implementation of WTSEnumerateProcessesW." }, + { "6df5c5c3-f06a-4506-ae04-a07d58652136:1", "Sebastian Lackner", "Fix incorrect scaling of DECIMAL values in VarDecAdd." }, ++ { "808eee8b-cf10-49e3-a4a0-3272e4c139c3:1", "Sebastian Lackner", "Return NULL-terminated list of arguments in CommandLineToArgvW." }, + { "0b21d7ac-0387-4493-aa38-fbafe3e749f5:2", "Michael Müller", "Decrease minimum SetTimer interval to 5 ms." }, + { "2394843e-2bc4-4fa4-8368-1ef32093b89e:1", "Michael Müller", "Allow changing strict draw ordering through an exported function." }, + { "255473fa-4e0a-4f51-952b-4deecc1a2181:1", "Michael Müller", "Indicate direct rendering through OpenGL extension." },