Vitaliy Margolen : shell32: Fix number of returned arguments from CommandLineToArgvW with empty string .

Alexandre Julliard julliard at winehq.org
Mon Mar 23 12:34:53 CDT 2009


Module: wine
Branch: master
Commit: 694219d4a66e7291213d2bdedd8dc995fdf16cf5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=694219d4a66e7291213d2bdedd8dc995fdf16cf5

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Sun Mar 15 20:29:48 2009 -0600

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 deletions(-)

diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c
index 78a2d57..ee62b9c 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 ededdec..863cea1 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)




More information about the wine-cvs mailing list