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
BOOL found_p1 = FALSE;
PWSTR res = out;
PCWSTR cmd;
DWORD used = 0;
DWORD size, used = 0;
TRACE("%p, %d, %s, %s, %p, %p\n", out, len, debugstr_w(fmt),
debugstr_w(lpFile), pidl, args);
......@@ -164,11 +164,16 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp
case 'l':
case 'L':
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)
{
lstrcpyW(res, lpFile);
res += lstrlenW(lpFile);
lstrcpyW(res, cmd);
res += lstrlenW(cmd);
}
}
found_p1 = TRUE;
......
......@@ -1624,7 +1624,7 @@ static void test_argify(void)
static void test_filename(void)
{
char filename[MAX_PATH + 20];
char filename[MAX_PATH + 20], curdir[MAX_PATH];
const filename_tests_t* test;
char* c;
INT_PTR rc;
......@@ -1635,6 +1635,31 @@ static void test_filename(void)
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;
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