Commit b8220e72 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shell32/shellview: Implement IFolderView::GetFolder() for IID_IShellFolder.

parent 8c92ba00
......@@ -2711,9 +2711,19 @@ static HRESULT WINAPI IFView_SetCurrentViewMode(IFolderView *iface, UINT mode)
static HRESULT WINAPI IFView_GetFolder(IFolderView *iface, REFIID riid, void **ppv)
{
IShellViewImpl *This = impl_from_IFolderView(iface);
FIXME("(%p)->(%s, %p), stub\n", This, debugstr_guid(riid), ppv);
return E_NOTIMPL;
IShellViewImpl *This = impl_from_IFolderView(iface);
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;
}
static HRESULT WINAPI IFView_Item(IFolderView *iface, int index, PITEMID_CHILD *ppidl)
......
......@@ -347,7 +347,7 @@ if (0)
static void test_IFolderView(void)
{
IShellFolder *desktop;
IShellFolder *desktop, *folder;
FOLDERSETTINGS settings;
IShellView *view;
IShellBrowser *browser;
......@@ -356,6 +356,7 @@ static void test_IFolderView(void)
HRESULT hr;
INT ret;
POINT pt;
LONG ref1, ref2;
RECT r;
hr = SHGetDesktopFolder(&desktop);
......@@ -448,6 +449,26 @@ if (0)
ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_getfocused_seq,
"IFolderView::GetFocusedItem", FALSE);
/* IFolderView::GetFolder, just return pointer */
if (0)
{
/* crashes on XP */
hr = IFolderView_GetFolder(fv, NULL, (void**)&folder);
hr = IFolderView_GetFolder(fv, NULL, NULL);
}
hr = IFolderView_GetFolder(fv, &IID_IShellFolder, NULL);
ok(hr == E_POINTER, "got (0x%08x)\n", hr);
ref1 = IShellFolder_AddRef(desktop);
IShellFolder_Release(desktop);
hr = IFolderView_GetFolder(fv, &IID_IShellFolder, (void**)&folder);
ok(hr == S_OK, "got (0x%08x)\n", hr);
ref2 = IShellFolder_AddRef(desktop);
IShellFolder_Release(desktop);
ok(ref1 == ref2, "expected same refcount, got %d\n", ref2);
ok(desktop == folder, "\n");
IShellBrowser_Release(browser);
IFolderView_Release(fv);
IShellView_Release(view);
......
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