Make sure that no files except unknwn.h include wine/obj_base.h
[wine] / dlls / shdocvw / classinfo.c
1 /*
2  * Implementation of IProvideClassInfo interfaces for IE Web Browser control
3  *
4  * Copyright 2001 John R. Sheets (for CodeWeavers)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include <string.h>
22
23 #include "winbase.h"
24 #include "shdocvw.h"
25 #include "wine/debug.h"
26
27 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
28
29 /**********************************************************************
30  * Implement the IProvideClassInfo interface
31  *
32  * FIXME: Should we just pass in the IProvideClassInfo2 methods rather
33  *        reimplementing them here?
34  */
35
36 static HRESULT WINAPI WBPCI_QueryInterface(LPPROVIDECLASSINFO iface,
37                                            REFIID riid, LPVOID *ppobj)
38 {
39     ICOM_THIS(IProvideClassInfoImpl, iface);
40
41     FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
42     return E_NOINTERFACE;
43 }
44
45 static ULONG WINAPI WBPCI_AddRef(LPPROVIDECLASSINFO iface)
46 {
47     ICOM_THIS(IProvideClassInfoImpl, iface);
48
49     TRACE("\n");
50     return ++(This->ref);
51 }
52
53 static ULONG WINAPI WBPCI_Release(LPPROVIDECLASSINFO iface)
54 {
55     ICOM_THIS(IProvideClassInfoImpl, iface);
56
57     /* static class, won't be freed */
58     TRACE("\n");
59     return --(This->ref);
60 }
61
62 /* Return an ITypeInfo interface to retrieve type library info about
63  * this control.
64  */
65 static HRESULT WINAPI WBPCI_GetClassInfo(LPPROVIDECLASSINFO iface, LPTYPEINFO *ppTI)
66 {
67     FIXME("stub: LPTYPEINFO = %p\n", *ppTI);
68     return S_OK;
69 }
70
71 /**********************************************************************
72  * IProvideClassInfo virtual function table for IE Web Browser component
73  */
74
75 static ICOM_VTABLE(IProvideClassInfo) WBPCI_Vtbl =
76 {
77     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
78     WBPCI_QueryInterface,
79     WBPCI_AddRef,
80     WBPCI_Release,
81     WBPCI_GetClassInfo
82 };
83
84 IProvideClassInfoImpl SHDOCVW_ProvideClassInfo = { &WBPCI_Vtbl, 1 };
85
86
87 /**********************************************************************
88  * Implement the IProvideClassInfo2 interface (inherits from
89  * IProvideClassInfo).
90  */
91
92 static HRESULT WINAPI WBPCI2_QueryInterface(LPPROVIDECLASSINFO2 iface,
93                                             REFIID riid, LPVOID *ppobj)
94 {
95     ICOM_THIS(IProvideClassInfo2Impl, iface);
96
97     FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
98     return E_NOINTERFACE;
99 }
100
101 static ULONG WINAPI WBPCI2_AddRef(LPPROVIDECLASSINFO2 iface)
102 {
103     ICOM_THIS(IProvideClassInfo2Impl, iface);
104
105     TRACE("\n");
106     return ++(This->ref);
107 }
108
109 static ULONG WINAPI WBPCI2_Release(LPPROVIDECLASSINFO2 iface)
110 {
111     ICOM_THIS(IProvideClassInfo2Impl, iface);
112
113     /* static class, won't be freed */
114     TRACE("\n");
115     return --(This->ref);
116 }
117
118 /* Return an ITypeInfo interface to retrieve type library info about
119  * this control.
120  */
121 static HRESULT WINAPI WBPCI2_GetClassInfo(LPPROVIDECLASSINFO2 iface, LPTYPEINFO *ppTI)
122 {
123     FIXME("stub: LPTYPEINFO = %p\n", *ppTI);
124     return S_OK;
125 }
126
127 /* Get the IID for generic default event callbacks.  This IID will
128  * in theory be used to later query for an IConnectionPoint to connect
129  * an event sink (callback implmentation in the OLE control site)
130  * to this control.
131 */
132 static HRESULT WINAPI WBPCI2_GetGUID(LPPROVIDECLASSINFO2 iface,
133                                      DWORD dwGuidKind, GUID *pGUID)
134 {
135     FIXME("stub: dwGuidKind = %ld, pGUID = %s\n", dwGuidKind, debugstr_guid(pGUID));
136
137     if (dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID)
138     {
139         FIXME ("Requested unsupported GUID type: %ld\n", dwGuidKind);
140         return E_FAIL;  /* Is there a better return type here? */
141     }
142
143     /* FIXME: Returning IPropertyNotifySink interface, but should really
144      * return a more generic event set (???) dispinterface.
145      * However, this hack, allows a control site to return with success
146      * (MFC's COleControlSite falls back to older IProvideClassInfo interface
147      * if GetGUID() fails to return a non-NULL GUID).
148      */
149     memcpy(pGUID, &IID_IPropertyNotifySink, sizeof(GUID));
150     FIXME("Wrongly returning IPropertyNotifySink interface %s\n",
151           debugstr_guid(pGUID));
152
153     return S_OK;
154 }
155
156 /**********************************************************************
157  * IProvideClassInfo virtual function table for IE Web Browser component
158  */
159
160 static ICOM_VTABLE(IProvideClassInfo2) WBPCI2_Vtbl =
161 {
162     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
163     WBPCI2_QueryInterface,
164     WBPCI2_AddRef,
165     WBPCI2_Release,
166     WBPCI2_GetClassInfo,
167     WBPCI2_GetGUID
168 };
169
170 IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2 = { &WBPCI2_Vtbl, 1 };