From be2a86cbd50eab8585571a2e3a46541b9df407b6 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Mon, 28 Dec 2009 20:08:46 +0100 Subject: [PATCH] mshtml: Query OleClientSite about services in ServiceProvider_QueryService. --- dlls/mshtml/service.c | 17 ++++++++++++++++- dlls/mshtml/tests/htmldoc.c | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/service.c b/dlls/mshtml/service.c index d120cf4e337..c77afe4b750 100644 --- a/dlls/mshtml/service.c +++ b/dlls/mshtml/service.c @@ -248,9 +248,24 @@ static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFG return S_OK; } + if(This->doc_obj->client) { + IServiceProvider *sp; + HRESULT hres; + + hres = IOleClientSite_QueryInterface(This->doc_obj->client, + &IID_IServiceProvider, (void**)&sp); + if(SUCCEEDED(hres)) { + hres = IServiceProvider_QueryService(sp, guidService, riid, ppv); + IServiceProvider_Release(sp); + + if(SUCCEEDED(hres)) + return hres; + } + } + FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv); - return E_UNEXPECTED; + return E_NOINTERFACE; } static const IServiceProviderVtbl ServiceProviderVtbl = { diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index 8a36bc1defa..d74bf967446 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -4508,6 +4508,24 @@ static void test_HTMLDocument_http(void) ok(!ref, "ref=%d, expected 0\n", ref); } +static void test_QueryService(IUnknown *unk, BOOL success) +{ + IServiceProvider *sp; + IHlinkFrame *hf; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IServiceProvider, (void**)&sp); + ok(hres == S_OK, "QueryService returned %08x\n", hres); + + hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf); + if(SUCCEEDED(hres)) + IHlinkFrame_Release(hf); + + ok(hres == (success?S_OK:E_NOINTERFACE), "QueryService returned %08x, expected %08x\n", hres, success?S_OK:E_NOINTERFACE); + + IServiceProvider_Release(sp); +} + static void test_HTMLDocument_StreamLoad(void) { IOleObject *oleobj; @@ -4535,7 +4553,9 @@ static void test_HTMLDocument_StreamLoad(void) test_readyState(unk); test_IsDirty(unk, S_FALSE); test_ConnectionPointContainer(unk); + test_QueryService(unk, FALSE); test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH); + test_QueryService(unk, TRUE); test_DoVerb(oleobj); test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);