- Always query for the correct stub interface, otherwise we will be
[wine] / dlls / mshtml / service.c
1 /*
2  * Copyright 2005 Jacek Caban
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
30 #include "docobj.h"
31
32 #include "mshtml.h"
33 #include "mshtmhst.h"
34
35 #include "wine/debug.h"
36
37 #include "mshtml_private.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
40
41 /**********************************************************
42  * IServiceProvider impementation
43  */
44
45 #define SERVPROV_THIS(iface) (HTMLDocument*)((BYTE*)(iface)-offsetof(HTMLDocument,lpServiceProviderVtbl))
46
47 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
48 {
49     HTMLDocument *This = SERVPROV_THIS(iface);
50     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
51 }
52
53 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
54 {
55     HTMLDocument *This = SERVPROV_THIS(iface);
56     return IHTMLDocument2_AddRef(HTMLDOC(This));
57 }
58
59 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
60 {
61     HTMLDocument *This = SERVPROV_THIS(iface);
62     return IHTMLDocument_Release(HTMLDOC(This));
63 }
64
65 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
66         REFIID riid, void **ppv)
67 {
68     HTMLDocument *This = SERVPROV_THIS(iface);
69     
70     /* NOTE:
71      * IE queries for service {3050f84b-98b5-11cf-bb82-00aa00bdce0b}.
72      * Its interface has the same IID and HTMLDocument also implements this
73      * interface. I conldn't find that interface is it.
74      */
75
76     FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
77     
78     return E_UNEXPECTED;
79 }
80
81 static const IServiceProviderVtbl ServiceProviderVtbl = {
82     ServiceProvider_QueryInterface,
83     ServiceProvider_AddRef,
84     ServiceProvider_Release,
85     ServiceProvider_QueryService
86 };
87
88 void HTMLDocument_Service_Init(HTMLDocument *This)
89 {
90     This->lpServiceProviderVtbl = &ServiceProviderVtbl;
91 }