Commit 6a1d2f80 authored by Erich Hoover's avatar Erich Hoover Committed by Alexandre Julliard

shell32: Fix FindExecutable search path when a default directory is supplied.

parent d685894a
......@@ -603,7 +603,13 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpOpera
{
TRACE("SearchPathW returned non-zero\n");
lpFile = xlpFile;
/* Hey, isn't this value ignored? Why make this call? Shouldn't we return here? --dank*/
/* The file was found in the application-supplied default directory (or the system search path) */
}
else if (lpPath && SearchPathW(NULL, lpFile, wszExe, sizeof(xlpFile)/sizeof(WCHAR), xlpFile, NULL))
{
TRACE("SearchPathW returned non-zero\n");
lpFile = xlpFile;
/* The file was found in one of the directories in the system-wide search path */
}
attribs = GetFileAttributesW(lpFile);
......
......@@ -1307,6 +1307,7 @@ static void test_filename(void)
static void test_find_executable(void)
{
char notepad_path[MAX_PATH];
char filename[MAX_PATH];
char command[MAX_PATH];
const filename_tests_t* test;
......@@ -1329,6 +1330,21 @@ static void test_find_executable(void)
ok(strcmp(command, "your word") != 0, "FindExecutable(NULL) returned command=[%s]\n", command);
}
GetSystemDirectoryA( notepad_path, MAX_PATH );
strcat( notepad_path, "\\notepad.exe" );
/* Search for something that should be in the system-wide search path (no default directory) */
strcpy(command, "your word");
rc=(INT_PTR)FindExecutableA("notepad.exe", NULL, command);
ok(rc > 32, "FindExecutable(%s) returned %ld\n", "notepad.exe", rc);
ok(strcasecmp(command, notepad_path) == 0, "FindExecutable(%s) returned command=[%s]\n", "notepad.exe", command);
/* Search for something that should be in the system-wide search path (with default directory) */
strcpy(command, "your word");
rc=(INT_PTR)FindExecutableA("notepad.exe", tmpdir, command);
ok(rc > 32, "FindExecutable(%s) returned %ld\n", "notepad.exe", rc);
ok(strcasecmp(command, notepad_path) == 0, "FindExecutable(%s) returned command=[%s]\n", "notepad.exe", command);
strcpy(command, "your word");
rc=(INT_PTR)FindExecutableA(tmpdir, NULL, command);
ok(rc == SE_ERR_NOASSOC /* >= win2000 */ || rc > 32 /* win98, nt4 */, "FindExecutable(NULL) returned %ld\n", rc);
......
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