Correct size check.
[wine/dcerpc.git] / dlls / shdocvw / events.c
blob7dd26561cb88878ec15d528111c17261fed8362b
1 /*
2 * Implementation of event-related interfaces for IE Web Browser control:
4 * - IConnectionPointContainer
5 * - IConnectionPoint
7 * Copyright 2001 John R. Sheets (for CodeWeavers)
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <string.h>
25 #include "wine/debug.h"
26 #include "shdocvw.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
30 static IConnectionPointImpl SHDOCVW_ConnectionPoint;
32 static const GUID IID_INotifyDBEvents =
33 { 0xdb526cc0, 0xd188, 0x11cd, { 0xad, 0x48, 0x00, 0xaa, 0x00, 0x3c, 0x9c, 0xb6 } };
35 /**********************************************************************
36 * Implement the IConnectionPointContainer interface
39 static HRESULT WINAPI WBCPC_QueryInterface(LPCONNECTIONPOINTCONTAINER iface,
40 REFIID riid, LPVOID *ppobj)
42 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
44 if (ppobj == NULL) return E_POINTER;
46 return E_NOINTERFACE;
49 static ULONG WINAPI WBCPC_AddRef(LPCONNECTIONPOINTCONTAINER iface)
51 SHDOCVW_LockModule();
53 return 2; /* non-heap based object */
56 static ULONG WINAPI WBCPC_Release(LPCONNECTIONPOINTCONTAINER iface)
58 SHDOCVW_UnlockModule();
60 return 1; /* non-heap based object */
63 /* Get a list of connection points inside this container. */
64 static HRESULT WINAPI WBCPC_EnumConnectionPoints(LPCONNECTIONPOINTCONTAINER iface,
65 LPENUMCONNECTIONPOINTS *ppEnum)
67 FIXME("stub: IEnumConnectionPoints = %p\n", *ppEnum);
68 return S_OK;
71 /* Retrieve the connection point in this container associated with the
72 * riid interface. When events occur in the control, the control can
73 * call backwards into its embedding site, through these interfaces.
75 static HRESULT WINAPI WBCPC_FindConnectionPoint(LPCONNECTIONPOINTCONTAINER iface,
76 REFIID riid, LPCONNECTIONPOINT *ppCP)
78 TRACE(": IID = %s, IConnectionPoint = %p\n", debugstr_guid(riid), *ppCP);
80 /* For now, return the same IConnectionPoint object for both
81 * event interface requests.
83 if (IsEqualGUID (&IID_INotifyDBEvents, riid))
85 TRACE("Returning connection point %p for IID_INotifyDBEvents\n",
86 &SHDOCVW_ConnectionPoint);
87 *ppCP = (LPCONNECTIONPOINT)&SHDOCVW_ConnectionPoint;
88 return S_OK;
90 else if (IsEqualGUID (&IID_IPropertyNotifySink, riid))
92 TRACE("Returning connection point %p for IID_IPropertyNotifySink\n",
93 &SHDOCVW_ConnectionPoint);
94 *ppCP = (LPCONNECTIONPOINT)&SHDOCVW_ConnectionPoint;
95 return S_OK;
98 return E_FAIL;
101 /**********************************************************************
102 * IConnectionPointContainer virtual function table for IE Web Browser component
105 static const IConnectionPointContainerVtbl WBCPC_Vtbl =
107 WBCPC_QueryInterface,
108 WBCPC_AddRef,
109 WBCPC_Release,
110 WBCPC_EnumConnectionPoints,
111 WBCPC_FindConnectionPoint
114 IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = {&WBCPC_Vtbl};
117 /**********************************************************************
118 * Implement the IConnectionPoint interface
121 static HRESULT WINAPI WBCP_QueryInterface(LPCONNECTIONPOINT iface,
122 REFIID riid, LPVOID *ppobj)
124 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
126 if (ppobj == NULL) return E_POINTER;
128 return E_NOINTERFACE;
131 static ULONG WINAPI WBCP_AddRef(LPCONNECTIONPOINT iface)
133 SHDOCVW_LockModule();
135 return 2; /* non-heap based object */
138 static ULONG WINAPI WBCP_Release(LPCONNECTIONPOINT iface)
140 SHDOCVW_UnlockModule();
142 return 1; /* non-heap based object */
145 static HRESULT WINAPI WBCP_GetConnectionInterface(LPCONNECTIONPOINT iface, IID* pIId)
147 FIXME("stub: %s\n", debugstr_guid(pIId));
148 return S_OK;
151 /* Get this connection point's owning container */
152 static HRESULT WINAPI
153 WBCP_GetConnectionPointContainer(LPCONNECTIONPOINT iface,
154 LPCONNECTIONPOINTCONTAINER *ppCPC)
156 FIXME("stub: IConnectionPointContainer = %p\n", *ppCPC);
157 return S_OK;
160 /* Connect the pUnkSink event-handling implementation (in the control site)
161 * to this connection point. Return a handle to this connection in
162 * pdwCookie (for later use in Unadvise()).
164 static HRESULT WINAPI WBCP_Advise(LPCONNECTIONPOINT iface,
165 LPUNKNOWN pUnkSink, DWORD *pdwCookie)
167 static int new_cookie;
169 FIXME("stub: IUnknown = %p, connection cookie = %ld\n", pUnkSink, *pdwCookie);
171 *pdwCookie = ++new_cookie;
172 TRACE ("Returning cookie = %ld\n", *pdwCookie);
174 return S_OK;
177 /* Disconnect this implementation from the connection point. */
178 static HRESULT WINAPI WBCP_Unadvise(LPCONNECTIONPOINT iface,
179 DWORD dwCookie)
181 FIXME("stub: cookie to disconnect = %lx\n", dwCookie);
182 return S_OK;
185 /* Get a list of connections in this connection point. */
186 static HRESULT WINAPI WBCP_EnumConnections(LPCONNECTIONPOINT iface,
187 LPENUMCONNECTIONS *ppEnum)
189 FIXME("stub: IEnumConnections = %p\n", *ppEnum);
190 return S_OK;
193 /**********************************************************************
194 * IConnectionPoint virtual function table for IE Web Browser component
197 static const IConnectionPointVtbl WBCP_Vtbl =
199 WBCP_QueryInterface,
200 WBCP_AddRef,
201 WBCP_Release,
202 WBCP_GetConnectionInterface,
203 WBCP_GetConnectionPointContainer,
204 WBCP_Advise,
205 WBCP_Unadvise,
206 WBCP_EnumConnections
209 static IConnectionPointImpl SHDOCVW_ConnectionPoint = {&WBCP_Vtbl};