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

This commit is contained in:
Nikolay Sivov 2010-03-06 23:55:55 +03:00 committed by Alexandre Julliard
parent 8c92ba009d
commit b8220e727c
2 changed files with 35 additions and 4 deletions

View File

@ -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)

View File

@ -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);