From d3aa44b20bb04cae26798f2a69fcf80452bad761 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 17 Dec 2010 03:28:34 +0100 Subject: [PATCH] shdocvw: Added support for QueryService(IID_IWebBrowserApp). --- dlls/shdocvw/client.c | 5 ++++ dlls/shdocvw/tests/webbrowser.c | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/dlls/shdocvw/client.c b/dlls/shdocvw/client.c index f1f4a3d2c1a..e94a32cbdf2 100644 --- a/dlls/shdocvw/client.c +++ b/dlls/shdocvw/client.c @@ -617,6 +617,11 @@ static HRESULT WINAPI ClServiceProvider_QueryService(IServiceProvider *iface, RE return IDispatch_QueryInterface(This->disp, riid, ppv); } + if(IsEqualGUID(&IID_IWebBrowserApp, guidService)) { + TRACE("IWebBrowserApp service\n"); + return IDispatch_QueryInterface(This->disp, riid, ppv); + } + FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv); return E_NOINTERFACE; diff --git a/dlls/shdocvw/tests/webbrowser.c b/dlls/shdocvw/tests/webbrowser.c index 6e3d54fde87..afde2e1d527 100644 --- a/dlls/shdocvw/tests/webbrowser.c +++ b/dlls/shdocvw/tests/webbrowser.c @@ -39,6 +39,7 @@ #include "shlguid.h" #include "exdispid.h" #include "mimeinfo.h" +#include "hlink.h" DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0); @@ -157,6 +158,21 @@ static int strcmp_wa(LPCWSTR strw, const char *stra) return lstrcmpA(stra, buf); } +static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2) +{ + IUnknown *unk1, *unk2; + + if(iface1 == iface2) + return TRUE; + + IUnknown_QueryInterface(iface1, &IID_IUnknown, (void**)&unk1); + IUnknown_Release(unk1); + IUnknown_QueryInterface(iface2, &IID_IUnknown, (void**)&unk2); + IUnknown_Release(unk2); + + return unk1 == unk2; +} + static const char *debugstr_guid(REFIID riid) { static char buf[50]; @@ -2807,6 +2823,31 @@ static void test_TranslateAccelerator(IUnknown *unk) test_UIActivate(unk, FALSE); } +static void test_dochost_qs(IUnknown *unk) +{ + IOleClientSite *client_site; + IServiceProvider *serv_prov; + IUnknown *service; + HRESULT hres; + + client_site = get_dochost(unk); + hres = IOleClientSite_QueryInterface(client_site, &IID_IServiceProvider, (void**)&serv_prov); + IOleClientSite_Release(client_site); + ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres); + + hres = IServiceProvider_QueryService(serv_prov, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&service); + ok(hres == S_OK, "QueryService failed: %08x\n", hres); + ok(iface_cmp(service, unk), "service != unk\n"); + IUnknown_Release(service); + + hres = IServiceProvider_QueryService(serv_prov, &IID_IWebBrowserApp, &IID_IHlinkFrame, (void**)&service); + ok(hres == S_OK, "QueryService failed: %08x\n", hres); + ok(iface_cmp(service, unk), "service != unk\n"); + IUnknown_Release(service); + + IServiceProvider_Release(serv_prov); +} + static void test_WebBrowser(BOOL do_download) { IUnknown *unk = NULL; @@ -2855,6 +2896,8 @@ static void test_WebBrowser(BOOL do_download) ok(doc == doc2, "doc != doc2\n"); IDispatch_Release(doc2); IDispatch_Release(doc2); + + test_dochost_qs(unk); } test_ClientSite(unk, NULL, !do_download);