Ensure MSSTYLES_SetActiveTheme fails properly when theme is invalid.
[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 <stdarg.h>
22 #include <string.h>
23
24 #include "windef.h"
25 #include "winbase.h"
26 #include "shdocvw.h"
27 #include "wine/debug.h"
28
29 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
30
31 /**********************************************************************
32  * Implement the IProvideClassInfo interface
33  *
34  * FIXME: Should we just pass in the IProvideClassInfo2 methods rather
35  *        reimplementing them here?
36  */
37
38 static HRESULT WINAPI WBPCI_QueryInterface(LPPROVIDECLASSINFO iface,
39                                            REFIID riid, LPVOID *ppobj)
40 {
41     ICOM_THIS(IProvideClassInfoImpl, iface);
42
43     FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
44     return E_NOINTERFACE;
45 }
46
47 static ULONG WINAPI WBPCI_AddRef(LPPROVIDECLASSINFO iface)
48 {
49     ICOM_THIS(IProvideClassInfoImpl, iface);
50
51     TRACE("\n");
52     return ++(This->ref);
53 }
54
55 static ULONG WINAPI WBPCI_Release(LPPROVIDECLASSINFO iface)
56 {
57     ICOM_THIS(IProvideClassInfoImpl, iface);
58
59     /* static class, won't be freed */
60     TRACE("\n");
61     return --(This->ref);
62 }
63
64 /* Return an ITypeInfo interface to retrieve type library info about
65  * this control.
66  */
67 static HRESULT WINAPI WBPCI_GetClassInfo(LPPROVIDECLASSINFO iface, LPTYPEINFO *ppTI)
68 {
69     FIXME("stub: LPTYPEINFO = %p\n", *ppTI);
70     return S_OK;
71 }
72
73 /**********************************************************************
74  * IProvideClassInfo virtual function table for IE Web Browser component
75  */
76
77 static ICOM_VTABLE(IProvideClassInfo) WBPCI_Vtbl =
78 {
79     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
80     WBPCI_QueryInterface,
81     WBPCI_AddRef,
82     WBPCI_Release,
83     WBPCI_GetClassInfo
84 };
85
86 IProvideClassInfoImpl SHDOCVW_ProvideClassInfo = { &WBPCI_Vtbl, 1 };
87
88
89 /**********************************************************************
90  * Implement the IProvideClassInfo2 interface (inherits from
91  * IProvideClassInfo).
92  */
93
94 static HRESULT WINAPI WBPCI2_QueryInterface(LPPROVIDECLASSINFO2 iface,
95                                             REFIID riid, LPVOID *ppobj)
96 {
97     ICOM_THIS(IProvideClassInfo2Impl, iface);
98
99     FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
100     return E_NOINTERFACE;
101 }
102
103 static ULONG WINAPI WBPCI2_AddRef(LPPROVIDECLASSINFO2 iface)
104 {
105     ICOM_THIS(IProvideClassInfo2Impl, iface);
106
107     TRACE("\n");
108     return ++(This->ref);
109 }
110
111 static ULONG WINAPI WBPCI2_Release(LPPROVIDECLASSINFO2 iface)
112 {
113     ICOM_THIS(IProvideClassInfo2Impl, iface);
114
115     /* static class, won't be freed */
116     TRACE("\n");
117     return --(This->ref);
118 }
119
120 /* Return an ITypeInfo interface to retrieve type library info about
121  * this control.
122  */
123 static HRESULT WINAPI WBPCI2_GetClassInfo(LPPROVIDECLASSINFO2 iface, LPTYPEINFO *ppTI)
124 {
125     FIXME("stub: LPTYPEINFO = %p\n", *ppTI);
126     return S_OK;
127 }
128
129 /* Get the IID for generic default event callbacks.  This IID will
130  * in theory be used to later query for an IConnectionPoint to connect
131  * an event sink (callback implmentation in the OLE control site)
132  * to this control.
133 */
134 static HRESULT WINAPI WBPCI2_GetGUID(LPPROVIDECLASSINFO2 iface,
135                                      DWORD dwGuidKind, GUID *pGUID)
136 {
137     FIXME("stub: dwGuidKind = %ld, pGUID = %s\n", dwGuidKind, debugstr_guid(pGUID));
138
139     if (dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID)
140     {
141         FIXME ("Requested unsupported GUID type: %ld\n", dwGuidKind);
142         return E_FAIL;  /* Is there a better return type here? */
143     }
144
145     /* FIXME: Returning IPropertyNotifySink interface, but should really
146      * return a more generic event set (???) dispinterface.
147      * However, this hack, allows a control site to return with success
148      * (MFC's COleControlSite falls back to older IProvideClassInfo interface
149      * if GetGUID() fails to return a non-NULL GUID).
150      */
151     memcpy(pGUID, &IID_IPropertyNotifySink, sizeof(GUID));
152     FIXME("Wrongly returning IPropertyNotifySink interface %s\n",
153           debugstr_guid(pGUID));
154
155     return S_OK;
156 }
157
158 /**********************************************************************
159  * IProvideClassInfo virtual function table for IE Web Browser component
160  */
161
162 static ICOM_VTABLE(IProvideClassInfo2) WBPCI2_Vtbl =
163 {
164     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
165     WBPCI2_QueryInterface,
166     WBPCI2_AddRef,
167     WBPCI2_Release,
168     WBPCI2_GetClassInfo,
169     WBPCI2_GetGUID
170 };
171
172 IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2 = { &WBPCI2_Vtbl, 1 };