From: Yuxuan Shui yshui@codeweavers.com
--- dlls/shell32/shellpath.c | 24 ++++++++++++++++++------ dlls/shell32/tests/shellpath.c | 1 + 2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 5d7f9d48ebd..e32bf5a50dc 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -694,10 +694,16 @@ static BOOL PathResolveA(char *path, const char **dirs, DWORD flags) if (flags & PRF_VERIFYEXISTS) { if (PathFindOnPathExA(path, dirs, dwWhich)) + { + if (!PathIsFileSpecA(path)) GetFullPathNameA(path, MAX_PATH, path, NULL); return TRUE; - if (!is_file_spec && PathFileExistsDefExtA(path, dwWhich)) - return TRUE; - if (!is_file_spec) GetFullPathNameA(path, MAX_PATH, path, NULL); + } + if (!is_file_spec) + { + GetFullPathNameA(path, MAX_PATH, path, NULL); + if (PathFileExistsDefExtA(path, dwWhich)) + return TRUE; + } SetLastError(ERROR_FILE_NOT_FOUND); return FALSE; } @@ -723,10 +729,16 @@ static BOOL PathResolveW(WCHAR *path, const WCHAR **dirs, DWORD flags) if (flags & PRF_VERIFYEXISTS) { if (PathFindOnPathExW(path, dirs, dwWhich)) + { + if (!PathIsFileSpecW(path)) GetFullPathNameW(path, MAX_PATH, path, NULL); return TRUE; - if (!is_file_spec && PathFileExistsDefExtW(path, dwWhich)) - return TRUE; - if (!is_file_spec) GetFullPathNameW(path, MAX_PATH, path, NULL); + } + if (!is_file_spec) + { + GetFullPathNameW(path, MAX_PATH, path, NULL); + if (PathFileExistsDefExtW(path, dwWhich)) + return TRUE; + } SetLastError(ERROR_FILE_NOT_FOUND); return FALSE; } diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index 5778dcc2fc8..fcf25c702ab 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -2963,6 +2963,7 @@ static void test_PathResolve(void) /* PRF_VERIFYEXISTS */ { L"shellpath", PRF_VERIFYEXISTS, TRUE, testfile_lnk }, { L"shellpath.lnk", PRF_VERIFYEXISTS, TRUE, testfile_lnk }, + { L"shellpath.lnk.", PRF_VERIFYEXISTS, TRUE, testfile_lnk }, { L"C:\shellpath", PRF_VERIFYEXISTS, FALSE, L"C:\shellpath" }, /* common extensions are tried even if PRF_TRYPROGRAMEXTENSIONS isn't passed */ /* directories in dirs parameter are always searched first even if PRF_FIRSTDIRDEF isn't passed */