From da70148afb107c4e47e9b2e7f33c39118e6a92df Mon Sep 17 00:00:00 2001 From: Huw D M Davies Date: Mon, 14 Jan 2002 18:35:44 +0000 Subject: [PATCH] IShellFolder_BindToObject should respect riid. --- dlls/shell32/shlfolder.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index 46aa71e3d57..b5e8f139141 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -736,6 +736,7 @@ static HRESULT WINAPI IShellFolder_fnBindToObject( IShellFolder2 * iface, LPCITE IShellFolder *pShellFolder, *pSubFolder; IPersistFolder *pPersistFolder; LPITEMIDLIST absPidl; + HRESULT hr; TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,debugstr_guid(riid),ppvOut); @@ -773,18 +774,28 @@ static HRESULT WINAPI IShellFolder_fnBindToObject( IShellFolder2 * iface, LPCITE if (_ILIsPidlSimple(pidl)) { - *ppvOut = pShellFolder; + if(IsEqualIID(riid, &IID_IShellFolder)) + { + *ppvOut = pShellFolder; + hr = S_OK; + } + else + { + hr = IShellFolder_QueryInterface(pShellFolder, riid, ppvOut); + IShellFolder_Release(pShellFolder); + } } else { - IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID)&pSubFolder); + hr = IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, + riid, (LPVOID)&pSubFolder); IShellFolder_Release(pShellFolder); *ppvOut = pSubFolder; } - TRACE("-- (%p) returning (%p)\n",This, *ppvOut); + TRACE("-- (%p) returning (%p) %08lx\n",This, *ppvOut, hr); - return S_OK; + return hr; } /************************************************************************** @@ -1764,7 +1775,8 @@ static HRESULT WINAPI ISF_Desktop_fnBindToObject( IShellFolder2 * iface, LPCITEM _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) GUID const * clsid; IShellFolder *pShellFolder, *pSubFolder; - + HRESULT hr; + TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n", This,pidl,pbcReserved,debugstr_guid(riid),ppvOut); @@ -1810,17 +1822,18 @@ static HRESULT WINAPI ISF_Desktop_fnBindToObject( IShellFolder2 * iface, LPCITEM if (_ILIsPidlSimple(pidl)) /* no sub folders */ { *ppvOut = pShellFolder; + hr = S_OK; } else /* go deeper */ { - IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, riid, (LPVOID)&pSubFolder); + hr = IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, riid, (LPVOID)&pSubFolder); IShellFolder_Release(pShellFolder); *ppvOut = pSubFolder; } - TRACE("-- (%p) returning (%p)\n",This, *ppvOut); + TRACE("-- (%p) returning (%p) %08lx\n",This, *ppvOut, hr); - return S_OK; + return hr; } /************************************************************************** @@ -2206,7 +2219,8 @@ static HRESULT WINAPI ISF_MyComputer_fnBindToObject( IShellFolder2 * iface, LPCI GUID const * clsid; IShellFolder *pShellFolder, *pSubFolder; LPITEMIDLIST pidltemp; - + HRESULT hr; + TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n", This,pidl,pbcReserved,debugstr_guid(riid),ppvOut); @@ -2233,17 +2247,19 @@ static HRESULT WINAPI ISF_MyComputer_fnBindToObject( IShellFolder2 * iface, LPCI if (_ILIsPidlSimple(pidl)) /* no sub folders */ { *ppvOut = pShellFolder; + hr = S_OK; } else /* go deeper */ { - IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID)&pSubFolder); + hr = IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, + riid, (LPVOID)&pSubFolder); IShellFolder_Release(pShellFolder); *ppvOut = pSubFolder; } - TRACE("-- (%p) returning (%p)\n",This, *ppvOut); + TRACE("-- (%p) returning (%p) %08lx\n",This, *ppvOut, hr); - return S_OK; + return hr; } /**************************************************************************