Fix the issue where some installers refuse to launch, due to `SHGetKnownFolderPath()` failing when called with `FOLDERID_UserProgramFiles`.
-- v2: shell32/tests: add tests to get path of FOLDERID_USerProgramFiles shell32: mark FOLDERID_UserProgramFiles as CSIDL_Type_User
From: Tingzhong Luo luotingzhong@uniontech.com
Fix the issue where some installers refuse to launch, due to SHGetKnownFolderPath() failing when called with FOLDERID_UserProgramFiles.
Signed-off-by: Tingzhong Luo luotingzhong@uniontech.com --- dlls/shell32/shellpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 1a52717651e..dad5949fdce 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -2039,7 +2039,7 @@ static const CSIDL_DATA CSIDL_Data[] = }, { /* 0x6e */ .id = &FOLDERID_UserProgramFiles, - .type = CSIDL_Type_Disallowed, /* FIXME */ + .type = CSIDL_Type_User, .category = KF_CATEGORY_PERUSER, .name = L"UserProgramFiles", .parent = &FOLDERID_LocalAppData,
From: Tingzhong Luo luotingzhong@uniontech.com
Signed-off-by: Tingzhong Luo luotingzhong@uniontech.com --- dlls/shell32/tests/shellpath.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index 2d9450652a1..8bec114af09 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -1974,6 +1974,20 @@ if (0) { /* crashes */ todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got 0x%08lx\n", hr); ok(path == NULL, "path set\n"); #endif + + /* check UserProgramFiles */ + path = NULL; + hr = pSHGetKnownFolderPath(&FOLDERID_UserProgramFiles, 0, NULL, &path); + ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr); + ok(path != NULL, "path not set\n"); + trace("FOLDERID_UserProgramFiles -> %s\n", wine_dbgstr_w(path)); + path2 = NULL; + len = ExpandEnvironmentStringsW(L"%LOCALAPPDATA%\Programs", NULL, -1); + path2 = CoTaskMemAlloc(sizeof(WCHAR) * (len + 1)); + ExpandEnvironmentStringsW(L"%LOCALAPPDATA%\Programs", path2, len); + ok(!StrCmpW(path, path2), "expected equal paths\n"); + CoTaskMemFree(path); + CoTaskMemFree(path2); }
static BOOL is_in_strarray(const WCHAR *needle, const char *hay)