On Windows, SHGDN_FORPARSING returns the GUID name of a special folder, but only when SHGDN_FORADDRESSBAR is not set.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
This is actually needed for proper enumeration implementation of e.g. the ACList_ISF class (not implemented yet but it will require this patch).
dlls/shell32/shfldr_desktop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/shell32/shfldr_desktop.c b/dlls/shell32/shfldr_desktop.c index d0b97c6..938871e 100644 --- a/dlls/shell32/shfldr_desktop.c +++ b/dlls/shell32/shfldr_desktop.c @@ -611,7 +611,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
if ((clsid = _ILGetGUIDPointer (pidl))) { - if (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING) + if ((GET_SHGDN_FOR (dwFlags) & (SHGDN_FORPARSING | SHGDN_FORADDRESSBAR)) == SHGDN_FORPARSING) { BOOL bWantsForParsing;
On Windows, SHGDN_FORPARSING returns the GUID name of a special folder, but only when SHGDN_FORADDRESSBAR is not set.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
This is needed for Control Panel and such (see tests in next patch).
dlls/shell32/shfldr_mycomp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/shell32/shfldr_mycomp.c b/dlls/shell32/shfldr_mycomp.c index 60f32f1..6a31e8c 100644 --- a/dlls/shell32/shfldr_mycomp.c +++ b/dlls/shell32/shfldr_mycomp.c @@ -615,7 +615,7 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface, clsid = _ILGetGUIDPointer (pidl); if (clsid) { - if (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING) + if ((GET_SHGDN_FOR (dwFlags) & (SHGDN_FORPARSING | SHGDN_FORADDRESSBAR)) == SHGDN_FORPARSING) { static const WCHAR clsidW[] = { 'C','L','S','I','D','\',0 };
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/shell32/tests/shfldr_special.c | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
diff --git a/dlls/shell32/tests/shfldr_special.c b/dlls/shell32/tests/shfldr_special.c index dd4cc04..b73759e 100644 --- a/dlls/shell32/tests/shfldr_special.c +++ b/dlls/shell32/tests/shfldr_special.c @@ -29,6 +29,7 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include "shellapi.h" +#include "shlwapi.h" #include "shlobj.h"
#include "wine/test.h" @@ -238,10 +239,64 @@ static void test_desktop_folder(void) IShellFolder_Release(psf); }
+static void test_desktop_displaynameof(void) +{ + static WCHAR MyComputer[] = { ':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}', 0 }; + static WCHAR MyDocuments[] = { ':',':','{','4','5','0','D','8','F','B','A','-','A','D','2','5','-','1','1','D','0','-','9','8','A','8','-','0','8','0','0','3','6','1','B','1','1','0','3','}', 0 }; + static WCHAR RecycleBin[] = { ':',':','{','6','4','5','F','F','0','4','0','-','5','0','8','1','-','1','0','1','B','-','9','F','0','8','-','0','0','A','A','0','0','2','F','9','5','4','E','}', 0 }; + static WCHAR ControlPanel[]= { ':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}','\', + ':',':','{','2','1','E','C','2','0','2','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','D','-','0','8','0','0','2','B','3','0','3','0','9','D','}', 0 }; + static WCHAR *folders[] = { MyComputer, MyDocuments, RecycleBin, ControlPanel }; + IShellFolder *desktop; + ITEMIDLIST *pidl; + STRRET strret; + DWORD eaten; + HRESULT hr; + UINT i; + + hr = SHGetDesktopFolder(&desktop); + ok(hr == S_OK, "SHGetDesktopFolder failed with error 0x%08x\n", hr); + if (FAILED(hr)) return; + + for (i = 0; i < ARRAY_SIZE(folders); i++) + { + WCHAR name1[MAX_PATH], name2[MAX_PATH]; + + hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, folders[i], &eaten, &pidl, NULL); + ok(hr == S_OK, "IShellFolder::ParseDisplayName failed with error 0x%08x\n", hr); + if (FAILED(hr)) continue; + + hr = IShellFolder_GetDisplayNameOf(desktop, pidl, SHGDN_INFOLDER, &strret); + ok(hr == S_OK, "IShellFolder::GetDisplayNameOf failed with error 0x%08x\n", hr); + hr = StrRetToBufW(&strret, pidl, name1, ARRAY_SIZE(name1)); + ok(hr == S_OK, "StrRetToBuf failed with error 0x%08x\n", hr); + + hr = IShellFolder_GetDisplayNameOf(desktop, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING | SHGDN_FORADDRESSBAR, &strret); + ok(hr == S_OK, "IShellFolder::GetDisplayNameOf failed with error 0x%08x\n", hr); + hr = StrRetToBufW(&strret, pidl, name2, ARRAY_SIZE(name2)); + ok(hr == S_OK, "StrRetToBuf failed with error 0x%08x\n", hr); + + ok(!lstrcmpW(name1, name2), "the display names are not equal: %s vs %s\n", wine_dbgstr_w(name1), wine_dbgstr_w(name2)); + ok(name1[0] != ':' || name1[1] != ':', "display name is a GUID: %s\n", wine_dbgstr_w(name1)); + + hr = IShellFolder_GetDisplayNameOf(desktop, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &strret); + ok(hr == S_OK, "IShellFolder::GetDisplayNameOf failed with error 0x%08x\n", hr); + hr = StrRetToBufW(&strret, pidl, name1, ARRAY_SIZE(name1)); + ok(hr == S_OK, "StrRetToBuf failed with error 0x%08x\n", hr); + + ok(lstrcmpW(name1, name2), "the display names are equal: %s\n", wine_dbgstr_w(name1)); + ok(name1[0] == ':' && name1[1] == ':', "display name is not a GUID: %s\n", wine_dbgstr_w(name1)); + + ILFree(pidl); + } + IShellFolder_Release(desktop); +} + START_TEST(shfldr_special) { test_parse_for_entire_network(); test_parse_for_control_panel(); test_printers_folder(); test_desktop_folder(); + test_desktop_displaynameof(); }