From: Yuxuan Shui yshui@codeweavers.com
FindExecutable should look in the current working directory, not relative to the current executable image (which is what SearchPathW(NULL, ...) does). --- dlls/shell32/tests/shlexec.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c index 11332484800..26609c232b9 100644 --- a/dlls/shell32/tests/shlexec.c +++ b/dlls/shell32/tests/shlexec.c @@ -2052,6 +2052,21 @@ static void test_find_executable(void) ok(rc == SE_ERR_NOASSOC /* >= win2000 */ || rc > 32 /* win98, nt4 */, "FindExecutable(NULL) returned %Id\n", rc); ok(strcmp(command, "your word") != 0, "FindExecutable(NULL) returned command=[%s]\n", command);
+ /* Search for the current executabe itself */ + strcpy(command, "your word"); + rc=(INT_PTR)FindExecutableA(argv0, NULL, command); + ok(rc > 32, "FindExecutable(%s) returned %Id\n", argv0, rc); + + /* Make sure FindExecutable uses the correct current directory */ + SetCurrentDirectoryA(tmpdir); + rc=CreateDirectoryA("tmpdir", NULL); + ok(rc || GetLastError() == ERROR_ALREADY_EXISTS, "Failed to create 'tmpdir' err %lu\n", GetLastError()); + SetCurrentDirectoryA("tmpdir"); + rc=(INT_PTR)FindExecutableA(argv0, NULL, command); + todo_wine ok(rc == ERROR_FILE_NOT_FOUND, "FindExecutable(%s) returned %Id\n", argv0, rc); + SetCurrentDirectoryA(".."); + RemoveDirectoryA("tmpdir"); + sprintf(filename, "%s\test file.sfe", tmpdir); rc=(INT_PTR)FindExecutableA(filename, NULL, command); ok(rc > 32, "FindExecutable(%s) returned %Id\n", filename, rc);