Called by IE11.
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/shell32/pidl.c | 9 +++++++++ dlls/shell32/shell32.spec | 1 + include/shlobj.h | 5 +++++ 3 files changed, 15 insertions(+)
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index 4c66a14c700..a87a8762a26 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -1285,6 +1285,15 @@ 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) +{ + FIXME("(%p, %p, %s, %p, %p) - semi-stub\n", psf, pidl, debugstr_guid(riid), ppv, ppidlLast); + return SHBindToParent(pidl, riid, ppv, ppidlLast); +} + /************************************************************************* * SHBindToParent [shell version 5.0] */ diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec index f8bf8f246e8..6348fcb3a6d 100644 --- a/dlls/shell32/shell32.spec +++ b/dlls/shell32/shell32.spec @@ -333,6 +333,7 @@ @ stdcall SHAppBarMessage(long ptr) @ stdcall SHAssocEnumHandlers(wstr long ptr) @ stdcall SHBindToObject(ptr ptr ptr ptr ptr) +@ stdcall SHBindToFolderIDListParent(ptr ptr ptr ptr ptr) @ stdcall SHBindToParent(ptr ptr ptr ptr) @ stdcall SHBrowseForFolder(ptr) SHBrowseForFolderA @ stdcall SHBrowseForFolderA(ptr) diff --git a/include/shlobj.h b/include/shlobj.h index d30944662f7..f4ef2edf76b 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -1639,6 +1639,11 @@ HRESULT WINAPI SHGetFolderPathW(HWND hwnd, int nFolder, HANDLE hToken, DWORD dwF */ HRESULT WINAPI SHGetDesktopFolder(IShellFolder * *);
+/**************************************************************************** + * SHBindToFolderIDListParent API + */ +HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast); + /**************************************************************************** * SHBindToParent API */
Called by IE11.
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/shell32/pidl.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index a87a8762a26..86dc43d3177 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -1290,8 +1290,48 @@ BOOL WINAPI SHGetPathFromIDListEx(LPCITEMIDLIST pidl, WCHAR *path, DWORD path_si */ HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast) { - FIXME("(%p, %p, %s, %p, %p) - semi-stub\n", psf, pidl, debugstr_guid(riid), ppv, ppidlLast); - return SHBindToParent(pidl, riid, ppv, 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; }
/*************************************************************************
Please add some tests for this.
On Wed, May 4, 2022 at 5:40 PM Nikolay Sivov nsivov@codeweavers.com wrote:
Please add some tests for this.
I wanted to but I'm not sure how to do this. Other than checking the HRESULT, I don't know what to check for. The existing test for SHBindToParent seems to be testing more than just that function. There's also no test for SHBindToObject, which would have been helpful to study.
-- Kind regards, Mohamad
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 86dc43d3177..86fc7a55bf5 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)
On 5/4/22 05:14, Mohamad Al-Jaf wrote:
+/*************************************************************************
- SHBindToFolderIDListParent [SHELL32.@]
- */
+HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast) +{
- FIXME("(%p, %p, %s, %p, %p) - semi-stub\n", psf, pidl, debugstr_guid(riid), ppv, ppidlLast);
- return SHBindToParent(pidl, riid, ppv, ppidlLast);
+}
You could merge this with patch 2/3.
+/****************************************************************************
- SHBindToFolderIDListParent API
- */
+HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast);
I'd remove this comment.
On Wed, May 4, 2022 at 5:36 PM Nikolay Sivov nsivov@codeweavers.com wrote:
On 5/4/22 05:14, Mohamad Al-Jaf wrote:
+/*************************************************************************
- SHBindToFolderIDListParent [SHELL32.@]
- */
+HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast) +{
- FIXME("(%p, %p, %s, %p, %p) - semi-stub\n", psf, pidl, debugstr_guid(riid), ppv, ppidlLast);
- return SHBindToParent(pidl, riid, ppv, ppidlLast);
+}
You could merge this with patch 2/3.
+/****************************************************************************
- SHBindToFolderIDListParent API
- */
+HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast);
I'd remove this comment.
Hi,
Thanks for the feedback. I'll resubmit with these changes.
-- Kind regards, Mohamad