Signed-off-by: Jinoh Kang jinoh.kang.kr@gmail.com ---
Notes: v1 -> v2: no changes
dlls/shell32/shellitem.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c index e85e31bce10..a3bcacbb531 100644 --- a/dlls/shell32/shellitem.c +++ b/dlls/shell32/shellitem.c @@ -198,6 +198,27 @@ static HRESULT ShellItem_get_shellfolder(ShellItem *This, IBindCtx *pbc, IShellF return ret; }
+static HRESULT ShellItem_get_uiobject(ShellItem *This, REFIID riid, void **ppvOut) +{ + IShellFolder *psf_parent; + HRESULT ret; + + if (_ILIsDesktop(This->pidl)) + ret = SHGetDesktopFolder(&psf_parent); + else + ret = ShellItem_get_parent_shellfolder(This, &psf_parent); + + if (SUCCEEDED(ret)) + { + LPCITEMIDLIST pidl = ILFindLastID(This->pidl); + ret = IShellFolder_GetUIObjectOf(psf_parent, NULL, 1, &pidl, riid, NULL, ppvOut); + IShellFolder_Release(psf_parent); + } + else *ppvOut = NULL; + + return ret; +} + static HRESULT WINAPI ShellItem_BindToHandler(IShellItem2 *iface, IBindCtx *pbc, REFGUID rbhid, REFIID riid, void **ppvOut) { @@ -219,19 +240,7 @@ static HRESULT WINAPI ShellItem_BindToHandler(IShellItem2 *iface, IBindCtx *pbc, } else if (IsEqualGUID(rbhid, &BHID_SFUIObject)) { - IShellFolder *psf_parent; - if (_ILIsDesktop(This->pidl)) - ret = SHGetDesktopFolder(&psf_parent); - else - ret = ShellItem_get_parent_shellfolder(This, &psf_parent); - - if (SUCCEEDED(ret)) - { - LPCITEMIDLIST pidl = ILFindLastID(This->pidl); - ret = IShellFolder_GetUIObjectOf(psf_parent, NULL, 1, &pidl, riid, NULL, ppvOut); - IShellFolder_Release(psf_parent); - } - return ret; + return ShellItem_get_uiobject(This, riid, ppvOut); } else if (IsEqualGUID(rbhid, &BHID_DataObject)) {