1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

shell32: PathResolve should remove trailing dot.

This commit is contained in:
Yuxuan Shui 2024-03-18 17:53:18 +00:00 committed by Alexandre Julliard
parent f59947bc10
commit a1d0e21b0a
2 changed files with 19 additions and 6 deletions

View file

@ -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;
}

View file

@ -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 */