Commit e5824959 authored by Thomas Faber's avatar Thomas Faber Committed by Alexandre Julliard

shell32: Use QueryInterface in FolderView_GetFolder.

test_IFolderView has a test that shows that the shell folder's reference count before and after the call to IFolderView_GetFolder is the same. However this is misleading because it is not a property of the IFolderView_GetFolder method, but of the desktop shell folder object that's used in the folder view. Windows <=2003 uses a cached object and its AddRef/Release methods return constants.
parent c0cd954f
......@@ -1477,6 +1477,7 @@ HRESULT WINAPI SHGetIDListFromObject(IUnknown *punk, PIDLIST_ABSOLUTE *ppidl)
{
/* We might be able to get IPersistFolder2 from a shellfolder. */
ret = SHGetIDListFromObject((IUnknown*)psf, ppidl);
IShellFolder_Release(psf);
}
IFolderView_Release(pfv);
return ret;
......
......@@ -2713,15 +2713,7 @@ static HRESULT WINAPI FolderView_GetFolder(IFolderView2 *iface, REFIID riid, voi
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
if (!ppv) return E_POINTER;
if (IsEqualIID(riid, &IID_IShellFolder))
{
*ppv = This->pSFParent;
return S_OK;
}
return E_NOINTERFACE;
return IShellFolder_QueryInterface(This->pSFParent, riid, ppv);
}
static HRESULT WINAPI FolderView_Item(IFolderView2 *iface, int index, PITEMID_CHILD *ppidl)
......
......@@ -1469,7 +1469,7 @@ static void test_navigation(void)
test_browse_pidl_sb(peb2, &ebev, pidl_relative, SBSP_RELATIVE, S_OK, 1, 1, 0, 1);
ILFree(pidl_relative);
/* IShellFolder_Release(psf); */
IShellFolder_Release(psf);
IFolderView_Release(pfv);
}
......
......@@ -688,6 +688,7 @@ static void test_IFolderView(void)
IShellBrowser *browser;
IFolderView2 *fv2;
IFolderView *fv;
IUnknown *unk;
HWND hwnd_view, hwnd_list;
PITEMID_CHILD pidl;
HRESULT hr;
......@@ -830,6 +831,11 @@ if (0)
ok(ref1 == ref2 || ref1 + 1 == ref2, /* >= vista */
"expected same refcount, got %d\n", ref2);
ok(desktop == folder, "\n");
if (folder) IShellFolder_Release(folder);
hr = IFolderView_GetFolder(fv, &IID_IUnknown, (void**)&unk);
ok(hr == S_OK, "got (0x%08x)\n", hr);
if (unk) IUnknown_Release(unk);
hr = IFolderView_QueryInterface(fv, &IID_IFolderView2, (void**)&fv2);
if (hr != S_OK)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment