[PATCH v2 0/1] MR10946: shell32: Don't add backslash after SHGetSpecialFolderPathW.
This fixes a regression implemented in 984f608c2885c80284ca8f35d6ad72d5193b3658 this breaks the game [Hyperdevotion Noire](https://store.steampowered.com/app/415480/Hyperdevotion_Noire_Goddess_Black_...). This game runs in proton 6.3-8 but is broken on versions after that. It seems most applications don't care about this, but this one in particular will crash when trying to access the My Documents directory due to this. -- v2: shell32: Don't add backslash after SHGetSpecialFolderPathW. https://gitlab.winehq.org/wine/wine/-/merge_requests/10946
From: Arimil <renari@arimil.com> --- dlls/shell32/shfldr_fs.c | 1 - dlls/shell32/tests/shlfolder.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c index fabd27e984f..0d74f4578c5 100644 --- a/dlls/shell32/shfldr_fs.c +++ b/dlls/shell32/shfldr_fs.c @@ -1409,7 +1409,6 @@ IFSFldr_PersistFolder3_Initialize (IPersistFolder3 * iface, LPCITEMIDLIST pidl) if (IsEqualCLSID( This->pclsid, &CLSID_MyDocuments )) { if (!SHGetSpecialFolderPathW( 0, wszTemp, CSIDL_PERSONAL, FALSE )) return E_FAIL; - PathAddBackslashW( wszTemp ); } else lstrcpyW( wszTemp, L"\\\\?\\unix\\" ); } diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index 5f8b4dc3470..08c8c73dd47 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -1501,6 +1501,34 @@ static void test_SHGetPathFromIDList(void) ok(result, "SHGetPathFromIDListW failed\n"); } +static void test_SHGetPathFromIDList_personal(void) +{ + WCHAR personal[MAX_PATH], path[MAX_PATH]; + LPITEMIDLIST pidl; + HRESULT hr; + BOOL ret; + int len; + + ret = SHGetSpecialFolderPathW(NULL, personal, CSIDL_PERSONAL, FALSE); + ok(ret, "SHGetSpecialFolderPathW(CSIDL_PERSONAL) failed, error %lu.\n", GetLastError()); + if (!ret) return; + + hr = SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl); + ok(hr == S_OK, "SHGetSpecialFolderLocation(CSIDL_PERSONAL) failed, hr %#lx.\n", hr); + if (hr != S_OK) return; + + ret = SHGetPathFromIDListW(pidl, path); + ILFree(pidl); + ok(ret, "SHGetPathFromIDListW(CSIDL_PERSONAL) failed, error %lu.\n", GetLastError()); + if (!ret) return; + ok(!lstrcmpiW(path, personal), "got %s, expected %s.\n", wine_dbgstr_w(path), + wine_dbgstr_w(personal)); + + len = lstrlenW(path); + ok(len && path[len - 1] != '\\', "CSIDL_PERSONAL path has trailing backslash: %s.\n", + wine_dbgstr_w(path)); +} + static void test_EnumObjects_and_CompareIDs(void) { ITEMIDLIST *newPIDL; @@ -6291,6 +6319,7 @@ START_TEST(shlfolder) test_GetDisplayName(); test_GetAttributesOf(); test_SHGetPathFromIDList(); + test_SHGetPathFromIDList_personal(); test_CallForAttributes(); test_FolderShortcut(); test_ITEMIDLIST_format(); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10946
participants (2)
-
Arie Miller (@Arimil) -
Arimil