Huw D M Davies <hdavies@codeweavers.com> IShellFolder_BindToObject should respect riid.
Index: dlls/shell32/shlfolder.c =================================================================== RCS file: /home/wine/wine/dlls/shell32/shlfolder.c,v retrieving revision 1.62 diff -u -r1.62 shlfolder.c --- dlls/shell32/shlfolder.c 2001/11/06 22:31:20 1.62 +++ dlls/shell32/shlfolder.c 2002/01/14 09:52:54 @@ -736,6 +736,7 @@ 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 @@ 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 @@ _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 @@ 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 @@ 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 @@ 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; } /**************************************************************************