From 84f15b15fb9ef74d567e98052563e2bf4c1a5127 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Fri, 29 Mar 2024 11:15:38 +0900 Subject: [PATCH] [SHELL32][SHELL32_APITEST] FindExecutable: Add PRF_FIRSTDIRDEF flag (#6681) Follow-up to #6635. The directory search without this flag didn't work. JIRA issue: CORE-19493 - Add PRF_FIRSTDIRDEF flag for PathResolveW call. - Delete needless macro definitions in PathQualifyExW. - Remove an assertion in IsLFNDriveW. - Fix shell32_apitest:FindExecutable testcase. --- dll/win32/shell32/shlexec.cpp | 2 +- dll/win32/shell32/wine/shellpath.c | 6 ------ modules/rostests/apitests/shell32/FindExecutable.cpp | 5 ----- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/dll/win32/shell32/shlexec.cpp b/dll/win32/shell32/shlexec.cpp index 10d2756013c..d71ff394849 100644 --- a/dll/win32/shell32/shlexec.cpp +++ b/dll/win32/shell32/shlexec.cpp @@ -1281,7 +1281,7 @@ HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory, LPWSTR lpR if (!GetShortPathNameW(lpFile, res, _countof(res))) StringCchCopyW(res, _countof(res), lpFile); - if (PathResolveW(res, dirs, PRF_TRYPROGRAMEXTENSIONS)) + if (PathResolveW(res, dirs, PRF_TRYPROGRAMEXTENSIONS | PRF_FIRSTDIRDEF)) { // NOTE: The last parameter of this AssocQueryStringW call is "strange" in Windows. if (PathIsExeW(res) || diff --git a/dll/win32/shell32/wine/shellpath.c b/dll/win32/shell32/wine/shellpath.c index 604d98020d0..160e25c03d1 100644 --- a/dll/win32/shell32/wine/shellpath.c +++ b/dll/win32/shell32/wine/shellpath.c @@ -223,10 +223,6 @@ PathQualifyExW(_Inout_ LPWSTR pszPath, _Inout_opt_ LPCWSTR pszDir, _In_ DWORD dw PWCHAR pch; for (pch = pchTemp; *pch != UNICODE_NULL; ++pch) { -#define PATH_CHAR_CLASS_DOT 0x00000004 -#define PATH_CHAR_CLASS_BACKSLASH 0x00000008 -#define PATH_CHAR_CLASS_COLON 0x00000010 -#define PATH_CHAR_CLASS_OTHER_VALID 0x00000100 #define VALID_SHORT_PATH_CHAR_CLASSES ( \ PATH_CHAR_CLASS_DOT | \ PATH_CHAR_CLASS_BACKSLASH | \ @@ -616,8 +612,6 @@ BOOL WINAPI IsLFNDriveW(LPCWSTR lpszPath) } else { - assert(!PathIsRelativeW(lpszPath)); /* Assuming absolute path... */ - iDrive = ((lpszPath[0] - L'A') & 0x1F); PathBuildRootW(szRoot, iDrive); diff --git a/modules/rostests/apitests/shell32/FindExecutable.cpp b/modules/rostests/apitests/shell32/FindExecutable.cpp index d5b6cfe443d..d483f62c3b0 100644 --- a/modules/rostests/apitests/shell32/FindExecutable.cpp +++ b/modules/rostests/apitests/shell32/FindExecutable.cpp @@ -71,11 +71,6 @@ static const TEST_ENTRY s_entries[] = { __LINE__, SE_ERR_FNF, "C:\\notepad.exe", DIR_2, "" }, { __LINE__, SE_ERR_FNF, "C:\\notepad.exe", DIR_3, "" }, { __LINE__, SE_ERR_FNF, "C:\\notepad.exe", DIR_4, "" }, - { __LINE__, SE_ERR_FNF, "..\\notepad.exe", DIR_0, "" }, - { __LINE__, SE_ERR_FNF, "..\\notepad.exe", DIR_1, "" }, - { __LINE__, SE_ERR_FNF, "..\\notepad.exe", DIR_2, "" }, - { __LINE__, SE_ERR_FNF, "..\\notepad.exe", DIR_3, "" }, - { __LINE__, SE_ERR_FNF, "..\\notepad.exe", DIR_4, "" }, { __LINE__, SE_ERR_FNF, ".\\notepad.exe", DIR_0, "" }, { __LINE__, SE_ERR_FNF, ".\\notepad.exe", DIR_1, "" }, { __LINE__, SE_ERR_FNF, ".\\notepad.exe", DIR_2, "" },