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

shell32: PathResolve should be able to find files that already have extensions.

Setting dwWhich to 0xff forces extensions to be appended, even when the file name already includes
an extension. This causes PathResolve to fail in some cases where the file does exist.
This commit is contained in:
Yuxuan Shui 2024-03-18 17:02:01 +00:00 committed by Alexandre Julliard
parent 5426e597bb
commit f59947bc10
2 changed files with 7 additions and 2 deletions

View file

@ -687,7 +687,7 @@ BOOL WINAPI PathFileExistsDefExtW(LPWSTR,DWORD);
static BOOL PathResolveA(char *path, const char **dirs, DWORD flags)
{
BOOL is_file_spec = PathIsFileSpecA(path);
DWORD dwWhich = flags & PRF_DONTFINDLNK ? 0xf : 0xff;
DWORD dwWhich = flags & PRF_DONTFINDLNK ? 0xf : 0xbf;
TRACE("(%s,%p,0x%08lx)\n", debugstr_a(path), dirs, flags);
@ -716,7 +716,7 @@ static BOOL PathResolveA(char *path, const char **dirs, DWORD flags)
static BOOL PathResolveW(WCHAR *path, const WCHAR **dirs, DWORD flags)
{
BOOL is_file_spec = PathIsFileSpecW(path);
DWORD dwWhich = flags & PRF_DONTFINDLNK ? 0xf : 0xff;
DWORD dwWhich = flags & PRF_DONTFINDLNK ? 0xf : 0xbf;
TRACE("(%s,%p,0x%08lx)\n", debugstr_w(path), dirs, flags);

View file

@ -2962,6 +2962,7 @@ static void test_PathResolve(void)
/* PRF_VERIFYEXISTS */
{ L"shellpath", 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 */
@ -3071,6 +3072,10 @@ static void test_PathResolve(void)
}
/* show that PathResolve will check specified search path, even if it's the current directory */
lstrcpyW(argv0_base, argv0_basep);
ret = pPathResolve(argv0_base, search_path, PRF_VERIFYEXISTS | PRF_TRYPROGRAMEXTENSIONS);
ok(ret, "resolving argv0 with search path failed unexpectedly, result: %s\n", wine_dbgstr_w(argv0_base));
lstrcpyW(argv0_base, argv0_basep);
if ((ext = wcsrchr(argv0_base, '.')))
{