set svn:eol-style to native
[reactos.git] / reactos / lib / 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 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
42
43 if (ppobj == NULL) return E_POINTER;
44
45 return E_NOINTERFACE;
46 }
47
48 static ULONG WINAPI WBPCI_AddRef(LPPROVIDECLASSINFO iface)
49 {
50 SHDOCVW_LockModule();
51
52 return 2; /* non-heap based object */
53 }
54
55 static ULONG WINAPI WBPCI_Release(LPPROVIDECLASSINFO iface)
56 {
57 SHDOCVW_UnlockModule();
58
59 return 1; /* non-heap based object */
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 IProvideClassInfoVtbl WBPCI_Vtbl =
76 {
77 WBPCI_QueryInterface,
78 WBPCI_AddRef,
79 WBPCI_Release,
80 WBPCI_GetClassInfo
81 };
82
83 IProvideClassInfoImpl SHDOCVW_ProvideClassInfo = { &WBPCI_Vtbl};
84
85
86 /**********************************************************************
87 * Implement the IProvideClassInfo2 interface (inherits from
88 * IProvideClassInfo).
89 */
90
91 static HRESULT WINAPI WBPCI2_QueryInterface(LPPROVIDECLASSINFO2 iface,
92 REFIID riid, LPVOID *ppobj)
93 {
94 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
95
96 if (ppobj == NULL) return E_POINTER;
97
98 return E_NOINTERFACE;
99 }
100
101 static ULONG WINAPI WBPCI2_AddRef(LPPROVIDECLASSINFO2 iface)
102 {
103 SHDOCVW_LockModule();
104
105 return 2; /* non-heap based object */
106 }
107
108 static ULONG WINAPI WBPCI2_Release(LPPROVIDECLASSINFO2 iface)
109 {
110 SHDOCVW_UnlockModule();
111
112 return 1; /* non-heap based object */
113 }
114
115 /* Return an ITypeInfo interface to retrieve type library info about
116 * this control.
117 */
118 static HRESULT WINAPI WBPCI2_GetClassInfo(LPPROVIDECLASSINFO2 iface, LPTYPEINFO *ppTI)
119 {
120 FIXME("stub: LPTYPEINFO = %p\n", *ppTI);
121 return S_OK;
122 }
123
124 /* Get the IID for generic default event callbacks. This IID will
125 * in theory be used to later query for an IConnectionPoint to connect
126 * an event sink (callback implementation in the OLE control site)
127 * to this control.
128 */
129 static HRESULT WINAPI WBPCI2_GetGUID(LPPROVIDECLASSINFO2 iface,
130 DWORD dwGuidKind, GUID *pGUID)
131 {
132 FIXME("stub: dwGuidKind = %ld, pGUID = %s\n", dwGuidKind, debugstr_guid(pGUID));
133
134 if (dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID)
135 {
136 FIXME ("Requested unsupported GUID type: %ld\n", dwGuidKind);
137 return E_FAIL; /* Is there a better return type here? */
138 }
139
140 /* FIXME: Returning IPropertyNotifySink interface, but should really
141 * return a more generic event set (???) dispinterface.
142 * However, this hack, allows a control site to return with success
143 * (MFC's COleControlSite falls back to older IProvideClassInfo interface
144 * if GetGUID() fails to return a non-NULL GUID).
145 */
146 memcpy(pGUID, &IID_IPropertyNotifySink, sizeof(GUID));
147 FIXME("Wrongly returning IPropertyNotifySink interface %s\n",
148 debugstr_guid(pGUID));
149
150 return S_OK;
151 }
152
153 /**********************************************************************
154 * IProvideClassInfo virtual function table for IE Web Browser component
155 */
156
157 static IProvideClassInfo2Vtbl WBPCI2_Vtbl =
158 {
159 WBPCI2_QueryInterface,
160 WBPCI2_AddRef,
161 WBPCI2_Release,
162 WBPCI2_GetClassInfo,
163 WBPCI2_GetGUID
164 };
165
166 IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2 = { &WBPCI2_Vtbl};