Module: wine Branch: master Commit: ae70b66dce4ed7dfaf45bfa7b6f3bd7d3f9576a4 URL: https://gitlab.winehq.org/wine/wine/-/commit/ae70b66dce4ed7dfaf45bfa7b6f3bd7...
Author: Yuxuan Shui yshui@codeweavers.com Date: Mon Mar 18 14:22:02 2024 +0000
shell32/tests: Check FindExecutable is looking in the correct current directory.
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 | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c index 11332484800..ba28bbc83d2 100644 --- a/dlls/shell32/tests/shlexec.c +++ b/dlls/shell32/tests/shlexec.c @@ -2009,9 +2009,11 @@ static void test_urls(void)
static void test_find_executable(void) { + char curdir[MAX_PATH]; char notepad_path[MAX_PATH]; char filename[MAX_PATH + 17]; char command[MAX_PATH]; + char *basename = strrchr(argv0, '\') + 1; const filename_tests_t* test; INT_PTR rc;
@@ -2052,6 +2054,18 @@ 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 */ + GetCurrentDirectoryA(MAX_PATH, curdir); + SetCurrentDirectoryA(tmpdir); + rc=(INT_PTR)FindExecutableA(basename, NULL, command); + todo_wine ok(rc == SE_ERR_FNF, "FindExecutable(%s) returned %Id\n", basename, rc); + SetCurrentDirectoryA(curdir); + sprintf(filename, "%s\test file.sfe", tmpdir); rc=(INT_PTR)FindExecutableA(filename, NULL, command); ok(rc > 32, "FindExecutable(%s) returned %Id\n", filename, rc);