From 3b545300b85ca23c53dfb56478182b29e37c9beb Mon Sep 17 00:00:00 2001 From: Ilya Basin Date: Sat, 24 Jul 2010 20:42:15 +0400 Subject: [PATCH] shell32/tests: CommandLineToArgvW("") shouldn't truncate returned exe path. --- dlls/shell32/tests/shlexec.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c index b883d0bcbf9..47f640f63f3 100644 --- a/dlls/shell32/tests/shlexec.c +++ b/dlls/shell32/tests/shlexec.c @@ -2118,8 +2118,9 @@ static void test_commandline(void) static const WCHAR chkfmt3[] = {'\\','\"','%','s','\"',0}; static const WCHAR chkfmt4[] = {'%','s','=','%','s','\"',' ','%','s','\"',0}; WCHAR cmdline[255]; - LPWSTR *args = (LPWSTR*)0xdeadcafe; + LPWSTR *args = (LPWSTR*)0xdeadcafe, pbuf; INT numargs = -1; + size_t buflen; wsprintfW(cmdline,fmt1,one,two,three,four); args=CommandLineToArgvW(cmdline,&numargs); @@ -2170,6 +2171,15 @@ static void test_commandline(void) wsprintfW(cmdline,fmt6); args=CommandLineToArgvW(cmdline,&numargs); ok(numargs == 1, "expected 1 args, got %i\n",numargs); + if (numargs == 1) { + buflen = max(lstrlenW(args[0])+1,256); + pbuf = HeapAlloc(GetProcessHeap(), 0, buflen*sizeof(pbuf[0])); + GetModuleFileNameW(NULL, pbuf, buflen); + pbuf[buflen-1] = 0; + /* check args[0] is module file name */ + ok(lstrcmpW(args[0],pbuf)==0, "wrong path to the current executable\n"); + HeapFree(GetProcessHeap(), 0, pbuf); + } } START_TEST(shlexec) -- 2.11.4.GIT