From 694219d4a66e7291213d2bdedd8dc995fdf16cf5 Mon Sep 17 00:00:00 2001 From: Vitaliy Margolen Date: Sun, 15 Mar 2009 20:29:48 -0600 Subject: [PATCH] shell32: Fix number of returned arguments from CommandLineToArgvW with empty string. --- dlls/shell32/shell32_main.c | 2 +- dlls/shell32/tests/shlexec.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index 78a2d578cf2..ee62b9cebda 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -111,7 +111,7 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs) } argv[0]=(LPWSTR)(argv+1); if (numargs) - *numargs=2; + *numargs=1; return argv; } diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c index ededdec4f82..863cea16120 100644 --- a/dlls/shell32/tests/shlexec.c +++ b/dlls/shell32/tests/shlexec.c @@ -1616,6 +1616,7 @@ static void test_commandline(void) static const WCHAR fmt3[] = {'%','s','=','%','s',' ','%','s','=','\"','%','s','\"',0}; static const WCHAR fmt4[] = {'\"','%','s','\"',' ','\"','%','s',' ','%','s','\"',' ','%','s',0}; static const WCHAR fmt5[] = {'\\','\"','%','s','\"',' ','%','s','=','\"','%','s','\\','\"',' ','\"','%','s','\\','\"',0}; + static const WCHAR fmt6[] = {0}; static const WCHAR chkfmt1[] = {'%','s','=','%','s',0}; static const WCHAR chkfmt2[] = {'%','s',' ','%','s',0}; @@ -1670,6 +1671,10 @@ static void test_commandline(void) todo_wine ok(lstrcmpW(args[0],cmdline)==0,"arg0 is not as expected\n"); wsprintfW(cmdline,chkfmt4,two,three,four); todo_wine ok(lstrcmpW(args[1],cmdline)==0,"arg1 is not as expected\n"); + + wsprintfW(cmdline,fmt6); + args=CommandLineToArgvW(cmdline,&numargs); + ok(numargs == 1, "expected 1 args, got %i\n",numargs); } START_TEST(shlexec) -- 2.11.4.GIT