Called by IE11.
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- This is the code I submitted on May 3. --- dlls/shell32/pidl.c | 49 +++++++++++++++++++++++++++++++++++++++ dlls/shell32/shell32.spec | 1 + include/shlobj.h | 2 ++ 3 files changed, 52 insertions(+)
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index f9c91a79132..e659427f9cd 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -1285,6 +1285,55 @@ BOOL WINAPI SHGetPathFromIDListEx(LPCITEMIDLIST pidl, WCHAR *path, DWORD path_si return SUCCEEDED(hr); }
+/************************************************************************* + * SHBindToFolderIDListParent [SHELL32.@] + */ +HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast) +{ + IShellFolder *psfDesktop = NULL; + HRESULT hr; + + TRACE_(shell)("%p,%p,%s\n", psf, pidl, debugstr_guid(riid)); + pdump(pidl); + + if (!pidl || !ppv) + return E_INVALIDARG; + + *ppv = NULL; + if (ppidlLast) + *ppidlLast = NULL; + + if (!psf) + { + hr = SHGetDesktopFolder(&psfDesktop); + if (FAILED(hr)) + return hr; + psf = psfDesktop; + } + + if (_ILIsPidlSimple(pidl)) + { + /* we are on desktop level */ + hr = IShellFolder_QueryInterface(psf, riid, ppv); + } + else + { + LPITEMIDLIST pidlParent = ILClone(pidl); + ILRemoveLastID(pidlParent); + hr = IShellFolder_BindToObject(psf, pidlParent, NULL, riid, ppv); + SHFree (pidlParent); + } + + if (psfDesktop) + IShellFolder_Release(psfDesktop); + + if (SUCCEEDED(hr) && ppidlLast) + *ppidlLast = ILFindLastID(pidl); + + TRACE_(shell)("-- ppv=%p pidl=%p ret=0x%08lx\n", *ppv, (ppidlLast)?*ppidlLast:NULL, hr); + return hr; +} + /************************************************************************* * SHBindToParent [shell version 5.0] */ diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec index f8bf8f246e8..5b812774e1f 100644 --- a/dlls/shell32/shell32.spec +++ b/dlls/shell32/shell32.spec @@ -334,6 +334,7 @@ @ stdcall SHAssocEnumHandlers(wstr long ptr) @ stdcall SHBindToObject(ptr ptr ptr ptr ptr) @ stdcall SHBindToParent(ptr ptr ptr ptr) +@ stdcall SHBindToFolderIDListParent(ptr ptr ptr ptr ptr) @ stdcall SHBrowseForFolder(ptr) SHBrowseForFolderA @ stdcall SHBrowseForFolderA(ptr) @ stdcall SHBrowseForFolderW(ptr) diff --git a/include/shlobj.h b/include/shlobj.h index d30944662f7..93f0201a991 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -1639,6 +1639,8 @@ HRESULT WINAPI SHGetFolderPathW(HWND hwnd, int nFolder, HANDLE hToken, DWORD dwF */ HRESULT WINAPI SHGetDesktopFolder(IShellFolder * *);
+HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast); + /**************************************************************************** * SHBindToParent API */
From: Dmitry Timoshkov dmitry@baikal.ru
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/shell32/tests/shlfolder.c | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index da606a9e707..1c482c06407 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -60,6 +60,7 @@ static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFIID,void**); static BOOL (WINAPI *pSHGetPathFromIDListEx)(PCIDLIST_ABSOLUTE,WCHAR*,DWORD,GPFIDL_FLAGS); static HRESULT (WINAPI *pSHGetSetFolderCustomSettings)(LPSHFOLDERCUSTOMSETTINGS,PCWSTR,DWORD); +static HRESULT (WINAPI *pSHBindToFolderIDListParent)(IShellFolder*,LPCITEMIDLIST,REFIID,void **,LPCITEMIDLIST*);
static WCHAR *make_wstr(const char *str) { @@ -89,6 +90,7 @@ static void init_function_pointers(void) hmod = GetModuleHandleA("shell32.dll");
#define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hmod, #f)) + MAKEFUNC(SHBindToFolderIDListParent); MAKEFUNC(SHCreateItemFromIDList); MAKEFUNC(SHCreateItemFromParsingName); MAKEFUNC(SHCreateItemFromRelativeName); @@ -5410,6 +5412,56 @@ static void test_SHGetSetFolderCustomSettings(void) RemoveDirectoryW(pathW); }
+static void test_SHBindToFolderIDListParent(void) +{ + IShellFolder *psf_desktop; + LPITEMIDLIST pidl; + HRESULT hr; + WCHAR path[MAX_PATH]; + SHITEMID empty_item = { 0, { 0 } }; + LPITEMIDLIST pidl_empty = (LPITEMIDLIST)&empty_item; + LPCITEMIDLIST pidl_last; + IShellFolder *psf; + + if (!pSHBindToFolderIDListParent) + { + win_skip("SHBindToFolderIDListParent not available\n"); + return; + } + + GetTempPathW(ARRAY_SIZE(path), path); + SHGetDesktopFolder(&psf_desktop); + + hr = IShellFolder_ParseDisplayName(psf_desktop, NULL, NULL, path, NULL, &pidl, 0); + ok(hr == S_OK, "got %#lx\n", hr); + + pidl_last = NULL; + hr = pSHBindToFolderIDListParent(psf_desktop, pidl, &IID_IShellFolder, (void **)&psf, &pidl_last); + ok(hr == S_OK, "got %#lx\n", hr); + ok(pidl_last != NULL, "got %p\n", pidl_last); + IShellFolder_Release(psf); + + hr = pSHBindToFolderIDListParent(NULL, pidl_empty, &IID_IShellFolder, (void **)&psf, &pidl_last); + ok(hr == S_OK, "got %#lx\n", hr); + ok(pidl_last == pidl_empty, "got %p\n", pidl_last); + IShellFolder_Release(psf); + + hr = pSHBindToFolderIDListParent(NULL, pidl, &IID_IShellFolder, (void **)&psf, NULL); + ok(hr == S_OK, "got %#lx\n", hr); + IShellFolder_Release(psf); + + if (0) /* crashes under Windows */ + hr = pSHBindToFolderIDListParent(NULL, pidl, &IID_IShellFolder, NULL, NULL); + + ILFree(pidl); + IShellFolder_Release(psf_desktop); + + pidl_last = (LPITEMIDLIST)0xdeadbeef; + hr = pSHBindToFolderIDListParent(NULL, NULL, &IID_IShellFolder, (void **)&psf, &pidl_last); + ok(hr == E_INVALIDARG, "got %#lx\n", hr); + ok(pidl_last == NULL, "got %p\n", pidl_last); +} + START_TEST(shlfolder) { init_function_pointers(); @@ -5417,6 +5469,7 @@ START_TEST(shlfolder) CO_E_NOTINITIALIZED for malformed directory names */ OleInitialize(NULL);
+ test_SHBindToFolderIDListParent(); test_ParseDisplayName(); test_SHParseDisplayName(); test_BindToObject();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116792
Your paranoid android.
=== w1064v1809 (32 bit report) ===
shell32: shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 40000)
=== w1064 (32 bit report) ===
shell32: shlfolder.c:4962: Test failed: MKDIR: expected notification type 8, got: 40000 shlfolder.c:4969: Test failed: GetDisplayNameOf failed: 0x80070057 shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 8)
=== w1064_tsign (32 bit report) ===
shell32: shlfolder.c:4962: Test failed: CREATE: expected notification type 2, got: 40000 shlfolder.c:4969: Test failed: GetDisplayNameOf failed: 0x80070057 shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 2)
=== w10pro64 (32 bit report) ===
shell32: shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4962: Test failed: CREATE: expected notification type 2, got: 4000000 shlfolder.c:4969: Test failed: GetDisplayNameOf failed: 0x80070057 shlfolder.c:4970: Test failed: Expected PIDL to be NULL shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3)
=== w1064v1809 (64 bit report) ===
shell32: shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3)
=== w1064 (64 bit report) ===
shell32: shlfolder.c:4962: Test failed: RMDIR: expected notification type 10, got: 40000 shlfolder.c:4969: Test failed: GetDisplayNameOf failed: 0x80070057 shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 10)
=== w1064_2qxl (64 bit report) ===
shell32: shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 40000)
=== w1064_adm (64 bit report) ===
shell32: shlfolder.c:4962: Test failed: CREATE: expected notification type 2, got: 40000 shlfolder.c:4969: Test failed: GetDisplayNameOf failed: 0x80070057 shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 2)
=== w1064_tsign (64 bit report) ===
shell32: shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 40000)
=== w10pro64 (64 bit report) ===
shell32: shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4962: Test failed: RMDIR: expected notification type 10, got: 40000 shlfolder.c:4969: Test failed: GetDisplayNameOf failed: 0x80070057 shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3)
=== w10pro64_en_AE_u8 (64 bit report) ===
shell32: shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3)
=== w10pro64_ar (64 bit report) ===
shell32: shlfolder.c:4962: Test failed: RMDIR: expected notification type 10, got: 40000 shlfolder.c:4969: Test failed: GetDisplayNameOf failed: 0x80070057 shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 10) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3)
=== w10pro64_zh_CN (64 bit report) ===
shell32: shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3) shlfolder.c:4962: Test failed: RMDIR: expected notification type 10, got: 40000 shlfolder.c:4969: Test failed: GetDisplayNameOf failed: 0x80070057 shlfolder.c:4979: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 3)
=== debian11 (32 bit report) ===
shell32: shlfolder.c:5462: Test failed: got DEADBEEF
=== debian11 (32 bit Arabic:Morocco report) ===
shell32: shlfolder.c:5462: Test failed: got DEADBEEF
=== debian11 (32 bit German report) ===
shell32: shlfolder.c:5462: Test failed: got DEADBEEF
=== debian11 (32 bit French report) ===
shell32: shlfolder.c:5462: Test failed: got DEADBEEF
=== debian11 (32 bit Hebrew:Israel report) ===
shell32: shlfolder.c:5462: Test failed: got DEADBEEF
=== debian11 (32 bit Hindi:India report) ===
shell32: shlfolder.c:5462: Test failed: got DEADBEEF
=== debian11 (32 bit Japanese:Japan report) ===
shell32: shlfolder.c:5462: Test failed: got DEADBEEF
=== debian11 (32 bit Chinese:China report) ===
shell32: shlfolder.c:5462: Test failed: got DEADBEEF
=== debian11 (32 bit WoW report) ===
shell32: shlfolder.c:5462: Test failed: got DEADBEEF
=== debian11 (64 bit WoW report) ===
shell32: shlfolder.c:5462: Test failed: got 00000000DEADBEEF
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/shell32/pidl.c | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-)
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index e659427f9cd..59968b066e4 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -1339,43 +1339,7 @@ HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *psf, LPCITEMIDLIST pidl, */ HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast) { - IShellFolder * psfDesktop; - HRESULT hr=E_FAIL; - - TRACE_(shell)("pidl=%p\n", pidl); - pdump(pidl); - - if (!pidl || !ppv) - return E_INVALIDARG; - - *ppv = NULL; - if (ppidlLast) - *ppidlLast = NULL; - - hr = SHGetDesktopFolder(&psfDesktop); - if (FAILED(hr)) - return hr; - - if (_ILIsPidlSimple(pidl)) - { - /* we are on desktop level */ - hr = IShellFolder_QueryInterface(psfDesktop, riid, ppv); - } - else - { - LPITEMIDLIST pidlParent = ILClone(pidl); - ILRemoveLastID(pidlParent); - hr = IShellFolder_BindToObject(psfDesktop, pidlParent, NULL, riid, ppv); - SHFree (pidlParent); - } - - IShellFolder_Release(psfDesktop); - - if (SUCCEEDED(hr) && ppidlLast) - *ppidlLast = ILFindLastID(pidl); - - TRACE_(shell)("-- psf=%p pidl=%p ret=0x%08lx\n", *ppv, (ppidlLast)?*ppidlLast:NULL, hr); - return hr; + return SHBindToFolderIDListParent(NULL, pidl, riid, ppv, ppidlLast); }
HRESULT WINAPI SHBindToObject(IShellFolder *psf, LPCITEMIDLIST pidl, IBindCtx *pbc, REFIID riid, void **ppv)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116793
Your paranoid android.
=== debian11 (32 bit report) ===
shell32: shlfolder.c:5462: Test failed: got DEADBEEF
=== debian11 (32 bit Chinese:China report) ===
shell32: shlfolder.c:5462: Test failed: got DEADBEEF
=== debian11 (32 bit WoW report) ===
shell32: shlfolder.c:5462: Test failed: got DEADBEEF
=== debian11 (64 bit WoW report) ===
shell32: shlfolder.c:5462: Test failed: got 00000000DEADBEEF