Commit 68fd74e7 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

shell32: Use SearchPathW() for %l/%L in SHELL_ArgifyW().

parent 2fcf40a6
...@@ -77,7 +77,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp ...@@ -77,7 +77,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp
BOOL found_p1 = FALSE; BOOL found_p1 = FALSE;
PWSTR res = out; PWSTR res = out;
PCWSTR cmd; PCWSTR cmd;
DWORD used = 0; DWORD size, used = 0;
TRACE("%p, %d, %s, %s, %p, %p\n", out, len, debugstr_w(fmt), TRACE("%p, %d, %s, %s, %p, %p\n", out, len, debugstr_w(fmt),
debugstr_w(lpFile), pidl, args); debugstr_w(lpFile), pidl, args);
...@@ -164,11 +164,16 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp ...@@ -164,11 +164,16 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp
case 'l': case 'l':
case 'L': case 'L':
if (lpFile) { if (lpFile) {
used += lstrlenW(lpFile); if ((size = SearchPathW(NULL, lpFile, L".exe", ARRAY_SIZE(xlpFile), xlpFile, NULL)
&& size <= ARRAY_SIZE(xlpFile)))
cmd = xlpFile;
else
cmd = lpFile;
used += lstrlenW(cmd);
if (used < len) if (used < len)
{ {
lstrcpyW(res, lpFile); lstrcpyW(res, cmd);
res += lstrlenW(lpFile); res += lstrlenW(cmd);
} }
} }
found_p1 = TRUE; found_p1 = TRUE;
......
...@@ -1624,7 +1624,7 @@ static void test_argify(void) ...@@ -1624,7 +1624,7 @@ static void test_argify(void)
static void test_filename(void) static void test_filename(void)
{ {
char filename[MAX_PATH + 20]; char filename[MAX_PATH + 20], curdir[MAX_PATH];
const filename_tests_t* test; const filename_tests_t* test;
char* c; char* c;
INT_PTR rc; INT_PTR rc;
...@@ -1635,6 +1635,31 @@ static void test_filename(void) ...@@ -1635,6 +1635,31 @@ static void test_filename(void)
return; return;
} }
GetCurrentDirectoryA(sizeof(curdir), curdir);
SetCurrentDirectoryA(tmpdir);
rc=shell_execute("QuotedLowerL", "simple.shlexec", NULL, NULL);
if (rc > 32)
rc=33;
okShell(rc == 33, "failed: rc=%Id err=%lu\n", rc, GetLastError());
okChildInt("argcA", 5);
okChildString("argvA3", "QuotedLowerL");
strcpy(filename, tmpdir);
strcat(filename, "\\simple.shlexec");
okChildPath("argvA4", filename);
rc=shell_execute("QuotedUpperL", "simple.shlexec", NULL, NULL);
if (rc > 32)
rc=33;
okShell(rc == 33, "failed: rc=%Id err=%lu\n", rc, GetLastError());
okChildInt("argcA", 5);
okChildString("argvA3", "QuotedUpperL");
strcpy(filename, tmpdir);
strcat(filename, "\\simple.shlexec");
okChildPath("argvA4", filename);
SetCurrentDirectoryA(curdir);
test=filename_tests; test=filename_tests;
while (test->basename) while (test->basename)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment