From ce87d64ab4414e5786c6d05a1001a0a312c1284e Mon Sep 17 00:00:00 2001 From: Nikolay Sivov <nsivov@codeweavers.com> Date: Wed, 6 May 2015 08:35:47 +0300 Subject: [PATCH] shell32: Implement Application property of IShellFolderViewDual. --- dlls/shell32/shlview.c | 9 +++- dlls/shell32/tests/shelldispatch.c | 87 ++++++++++++++++++++---------- include/shldisp.idl | 18 ++++--- 3 files changed, 78 insertions(+), 36 deletions(-) diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index 8352157afef..6ddb9378184 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -3518,8 +3518,13 @@ static HRESULT WINAPI shellfolderviewdual_get_Application(IShellFolderViewDual3 IDispatch **disp) { IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface); - FIXME("%p %p\n", This, disp); - return E_NOTIMPL; + + TRACE("%p %p\n", This, disp); + + if (!disp) + return E_INVALIDARG; + + return IShellDispatch_Constructor(NULL, &IID_IDispatch, (void**)disp); } static HRESULT WINAPI shellfolderviewdual_get_Parent(IShellFolderViewDual3 *iface, IDispatch **disp) diff --git a/dlls/shell32/tests/shelldispatch.c b/dlls/shell32/tests/shelldispatch.c index b7773ad7175..f0341323162 100644 --- a/dlls/shell32/tests/shelldispatch.c +++ b/dlls/shell32/tests/shelldispatch.c @@ -364,8 +364,42 @@ static void test_service(void) IShellDispatch2_Release(sd); } +static void test_dispatch_typeinfo(IDispatch *disp, REFIID *riid) +{ + ITypeInfo *typeinfo; + TYPEATTR *typeattr; + UINT count; + HRESULT hr; + + count = 10; + hr = IDispatch_GetTypeInfoCount(disp, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(count == 1, "got %u\n", count); + + hr = IDispatch_GetTypeInfo(disp, 0, LOCALE_SYSTEM_DEFAULT, &typeinfo); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr); + ok(hr == S_OK, "got 0x%08x\n", hr); + while (!IsEqualGUID(*riid, &IID_NULL)) { + if (IsEqualGUID(&typeattr->guid, *riid)) + break; + riid++; + } + ok(IsEqualGUID(&typeattr->guid, *riid), "unexpected type guid %s\n", wine_dbgstr_guid(&typeattr->guid)); + + ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr); + ITypeInfo_Release(typeinfo); +} + static void test_ShellFolderViewDual(void) { + static const REFIID shelldisp_riids[] = { + &IID_IShellDispatch6, + &IID_IShellDispatch5, + &IID_IShellDispatch4, + &IID_NULL + }; IShellFolderViewDual *viewdual; IShellFolder *desktop, *tmpdir; IShellView *view, *view2; @@ -399,6 +433,18 @@ static void test_ShellFolderViewDual(void) hr = IShellFolderViewDual_QueryInterface(viewdual, &IID_IShellView, (void**)&view2); ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr); + /* get_Application() */ + +if (0) /* crashes on pre-vista */ { + hr = IShellFolderViewDual_get_Application(viewdual, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); +} + hr = IShellFolderViewDual_get_Application(viewdual, &disp2); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(disp2 != (IDispatch*)viewdual, "got %p, %p\n", disp2, viewdual); + test_dispatch_typeinfo(disp2, shelldisp_riids); + IDispatch_Release(disp2); + IShellFolderViewDual_Release(viewdual); IDispatch_Release(disp); @@ -510,35 +556,29 @@ todo_wine { ok(ret == 0, "got %d\n", ret); } else { + static const REFIID browser_riids[] = { + &IID_IWebBrowser2, + &IID_NULL + }; + + static const REFIID viewdual_riids[] = { + &IID_IShellFolderViewDual3, + &IID_NULL + }; + IShellFolderViewDual *view; IShellBrowser *sb, *sb2; IServiceProvider *sp; IDispatch *doc, *app; - ITypeInfo *typeinfo; - TYPEATTR *typeattr; IWebBrowser2 *wb; IShellView *sv; IUnknown *unk; - UINT count; ok(disp != NULL, "got %p\n", disp); ok(ret != HandleToUlong(hwnd), "got %d\n", ret); /* IDispatch-related tests */ - count = 10; - hr = IDispatch_GetTypeInfoCount(disp, &count); - ok(hr == S_OK, "got 0x%08x\n", hr); - ok(count == 1, "got %u\n", count); - - hr = IDispatch_GetTypeInfo(disp, 0, LOCALE_SYSTEM_DEFAULT, &typeinfo); - ok(hr == S_OK, "got 0x%08x\n", hr); - - hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr); - ok(hr == S_OK, "got 0x%08x\n", hr); - ok(IsEqualGUID(&typeattr->guid, &IID_IWebBrowser2), "type guid %s\n", wine_dbgstr_guid(&typeattr->guid)); - - ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr); - ITypeInfo_Release(typeinfo); + test_dispatch_typeinfo(disp, browser_riids); /* IWebBrowser2 */ hr = IDispatch_QueryInterface(disp, &IID_IWebBrowser2, (void**)&wb); @@ -556,18 +596,9 @@ todo_wine hr = IWebBrowser2_get_Document(wb, &doc); todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); -if (hr == S_OK) { - hr = IDispatch_GetTypeInfo(doc, 0, LOCALE_SYSTEM_DEFAULT, &typeinfo); - ok(hr == S_OK, "got 0x%08x\n", hr); +if (hr == S_OK) + test_dispatch_typeinfo(doc, viewdual_riids); - hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr); - ok(hr == S_OK, "got 0x%08x\n", hr); - ok(IsEqualGUID(&typeattr->guid, &IID_IShellFolderViewDual3), "type guid %s\n", wine_dbgstr_guid(&typeattr->guid)); - IDispatch_Release(doc); - - ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr); - ITypeInfo_Release(typeinfo); -} IWebBrowser2_Release(wb); /* IServiceProvider */ diff --git a/include/shldisp.idl b/include/shldisp.idl index 506c5d24321..56be77833c1 100644 --- a/include/shldisp.idl +++ b/include/shldisp.idl @@ -403,7 +403,6 @@ interface FolderItemVerbs : IDispatch * IShellDispatch interface */ [ - object, uuid(d8f015c0-c278-11ce-a49e-444553540000), oleautomation, hidden, @@ -465,7 +464,6 @@ interface IShellDispatch : IDispatch } [ - object, uuid(a4c6892c-3ba9-11d2-9dea-00c04fb16162), oleautomation, hidden, @@ -486,7 +484,6 @@ interface IShellDispatch2 : IShellDispatch } [ - object, uuid(177160ca-bb5a-411c-841d-bd38facdeaa0), oleautomation, hidden, @@ -498,7 +495,6 @@ interface IShellDispatch3 : IShellDispatch2 } [ - object, uuid(efd84b2d-4bcf-4298-be25-eb542a59fbda), oleautomation, hidden, @@ -513,7 +509,6 @@ interface IShellDispatch4 : IShellDispatch3 } [ - object, uuid(866738b9-6cf2-4de8-8767-f794ebe74f4e), oleautomation, hidden, @@ -524,12 +519,23 @@ interface IShellDispatch5 : IShellDispatch4 HRESULT WindowSwitcher(); } +[ + uuid(286e6f1b-7113-4355-9562-96b7e9d64c54), + oleautomation, + hidden, + dual, +] +interface IShellDispatch6 : IShellDispatch5 +{ + HRESULT SearchCommand(void); +} + [ uuid(13709620-c279-11ce-a49e-444553540000) ] coclass Shell { - [default] interface IShellDispatch2; + [default] interface IShellDispatch6; } [ -- GitLab