SHDOCVW: Make IConnectionPointContainer interface heap based

Jacek Caban jack at itma.pwr.wroc.pl
Fri Sep 9 11:54:02 CDT 2005


Changelog:
    Make IConnectionPointContainer interface heap based
-------------- next part --------------
Index: dlls/shdocvw/events.c
===================================================================
RCS file: /home/wine/wine/dlls/shdocvw/events.c,v
retrieving revision 1.15
diff -u -p -r1.15 events.c
--- dlls/shdocvw/events.c	12 Jun 2005 10:42:03 -0000	1.15
+++ dlls/shdocvw/events.c	9 Sep 2005 16:48:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Implementation of event-related interfaces for IE Web Browser control:
+ * Implementation of event-related interfaces for WebBrowser control:
  *
  *  - IConnectionPointContainer
  *  - IConnectionPoint
@@ -36,46 +36,41 @@ static const GUID IID_INotifyDBEvents =
  * Implement the IConnectionPointContainer interface
  */
 
-static HRESULT WINAPI WBCPC_QueryInterface(LPCONNECTIONPOINTCONTAINER iface,
-                                           REFIID riid, LPVOID *ppobj)
-{
-    FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
+#define CONPTCONT_THIS(iface) DEFINE_THIS(WebBrowser, ConnectionPointContainer, iface)
 
-    if (ppobj == NULL) return E_POINTER;
-    
-    return E_NOINTERFACE;
+static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
+        REFIID riid, LPVOID *ppobj)
+{
+    WebBrowser *This = CONPTCONT_THIS(iface);
+    return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
 }
 
-static ULONG WINAPI WBCPC_AddRef(LPCONNECTIONPOINTCONTAINER iface)
+static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
 {
-    SHDOCVW_LockModule();
-
-    return 2; /* non-heap based object */
+    WebBrowser *This = CONPTCONT_THIS(iface);
+    return IWebBrowser_AddRef(WEBBROWSER(This));
 }
 
-static ULONG WINAPI WBCPC_Release(LPCONNECTIONPOINTCONTAINER iface)
+static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
 {
-    SHDOCVW_UnlockModule();
-
-    return 1; /* non-heap based object */
+    WebBrowser *This = CONPTCONT_THIS(iface);
+    return IWebBrowser_Release(WEBBROWSER(This));
 }
 
-/* Get a list of connection points inside this container. */
-static HRESULT WINAPI WBCPC_EnumConnectionPoints(LPCONNECTIONPOINTCONTAINER iface,
-                                                 LPENUMCONNECTIONPOINTS *ppEnum)
+static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface,
+        LPENUMCONNECTIONPOINTS *ppEnum)
 {
-    FIXME("stub: IEnumConnectionPoints = %p\n", *ppEnum);
-    return S_OK;
+    WebBrowser *This = CONPTCONT_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, ppEnum);
+    return E_NOTIMPL;
 }
 
-/* Retrieve the connection point in this container associated with the
- * riid interface.  When events occur in the control, the control can
- * call backwards into its embedding site, through these interfaces.
- */
-static HRESULT WINAPI WBCPC_FindConnectionPoint(LPCONNECTIONPOINTCONTAINER iface,
-                                                REFIID riid, LPCONNECTIONPOINT *ppCP)
+static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface,
+        REFIID riid, LPCONNECTIONPOINT *ppCP)
 {
-    TRACE(": IID = %s, IConnectionPoint = %p\n", debugstr_guid(riid), *ppCP);
+    WebBrowser *This = CONPTCONT_THIS(iface);
+
+    FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppCP);
 
     /* For now, return the same IConnectionPoint object for both
      * event interface requests.
@@ -98,21 +93,17 @@ static HRESULT WINAPI WBCPC_FindConnecti
     return E_FAIL;
 }
 
-/**********************************************************************
- * IConnectionPointContainer virtual function table for IE Web Browser component
- */
+#undef CONPTCONT_THIS
 
-static const IConnectionPointContainerVtbl WBCPC_Vtbl =
+static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl =
 {
-    WBCPC_QueryInterface,
-    WBCPC_AddRef,
-    WBCPC_Release,
-    WBCPC_EnumConnectionPoints,
-    WBCPC_FindConnectionPoint
+    ConnectionPointContainer_QueryInterface,
+    ConnectionPointContainer_AddRef,
+    ConnectionPointContainer_Release,
+    ConnectionPointContainer_EnumConnectionPoints,
+    ConnectionPointContainer_FindConnectionPoint
 };
 
-IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = {&WBCPC_Vtbl};
-
 
 /**********************************************************************
  * Implement the IConnectionPoint interface
@@ -207,3 +198,8 @@ static const IConnectionPointVtbl WBCP_V
 };
 
 static IConnectionPointImpl SHDOCVW_ConnectionPoint = {&WBCP_Vtbl};
+
+void WebBrowser_Events_Init(WebBrowser *This)
+{
+    This->lpConnectionPointContainerVtbl = &ConnectionPointContainerVtbl;
+}
Index: dlls/shdocvw/shdocvw.h
===================================================================
RCS file: /home/wine/wine/dlls/shdocvw/shdocvw.h,v
retrieving revision 1.20
diff -u -p -r1.20 shdocvw.h
--- dlls/shdocvw/shdocvw.h	9 Sep 2005 10:05:40 -0000	1.20
+++ dlls/shdocvw/shdocvw.h	9 Sep 2005 16:48:04 -0000
@@ -53,48 +53,38 @@ extern IClassFactoryImpl SHDOCVW_ClassFa
  * WebBrowser declaration for SHDOCVW.DLL
  */
 typedef struct {
-    const IWebBrowserVtbl         *lpWebBrowserVtbl;
-    const IOleObjectVtbl          *lpOleObjectVtbl;
-    const IOleInPlaceObjectVtbl   *lpOleInPlaceObjectVtbl;
-    const IOleControlVtbl         *lpOleControlVtbl;
-    const IPersistStorageVtbl     *lpPersistStorageVtbl;
-    const IPersistStreamInitVtbl  *lpPersistStreamInitVtbl;
-    const IProvideClassInfo2Vtbl  *lpProvideClassInfoVtbl;
-    const IQuickActivateVtbl      *lpQuickActivateVtbl;
+    const IWebBrowserVtbl               *lpWebBrowserVtbl;
+    const IOleObjectVtbl                *lpOleObjectVtbl;
+    const IOleInPlaceObjectVtbl         *lpOleInPlaceObjectVtbl;
+    const IOleControlVtbl               *lpOleControlVtbl;
+    const IPersistStorageVtbl           *lpPersistStorageVtbl;
+    const IPersistStreamInitVtbl        *lpPersistStreamInitVtbl;
+    const IProvideClassInfo2Vtbl        *lpProvideClassInfoVtbl;
+    const IQuickActivateVtbl            *lpQuickActivateVtbl;
+    const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
 
     LONG ref;
 } WebBrowser;
 
-#define WEBBROWSER(x)   ((IWebBrowser*)         &(x)->lpWebBrowserVtbl)
-#define OLEOBJ(x)       ((IOleObject*)          &(x)->lpOleObjectVtbl)
-#define INPLACEOBJ(x)   ((IOleInPlaceObject*)   &(x)->lpOleInPlaceObjectVtbl)
-#define CONTROL(x)      ((IOleControl*)         &(x)->lpOleControlVtbl)
-#define PERSTORAGE(x)   ((IPersistStorage*)     &(x)->lpPersistStorageVtbl)
-#define PERSTRINIT(x)   ((IPersistStreamInit*)  &(x)->lpPersistStreamInitVtbl)
-#define CLASSINFO(x)    ((IProvideClassInfo2*)  &(x)->lpProvideClassInfoVtbl)
-#define QUICKACT(x)     ((IQuickActivate*)      &(x)->lpQuickActivateVtbl)
+#define WEBBROWSER(x)   ((IWebBrowser*)                 &(x)->lpWebBrowserVtbl)
+#define OLEOBJ(x)       ((IOleObject*)                  &(x)->lpOleObjectVtbl)
+#define INPLACEOBJ(x)   ((IOleInPlaceObject*)           &(x)->lpOleInPlaceObjectVtbl)
+#define CONTROL(x)      ((IOleControl*)                 &(x)->lpOleControlVtbl)
+#define PERSTORAGE(x)   ((IPersistStorage*)             &(x)->lpPersistStorageVtbl)
+#define PERSTRINIT(x)   ((IPersistStreamInit*)          &(x)->lpPersistStreamInitVtbl)
+#define CLASSINFO(x)    ((IProvideClassInfo2*)          &(x)->lpProvideClassInfoVtbl)
+#define QUICKACT(x)     ((IQuickActivate*)              &(x)->lpQuickActivateVtbl)
+#define CONPTCONT(x)    ((IConnectionPointContainer*)   &(x)->lpConnectionPointContainerVtbl)
 
 void WebBrowser_OleObject_Init(WebBrowser*);
 void WebBrowser_Persist_Init(WebBrowser*);
 void WebBrowser_ClassInfo_Init(WebBrowser*);
 void WebBrowser_Misc_Init(WebBrowser*);
+void WebBrowser_Events_Init(WebBrowser*);
 
 HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
 
 /**********************************************************************
- * IConnectionPointContainer declaration for SHDOCVW.DLL
- */
-typedef struct
-{
-    /* IUnknown fields */
-    const IConnectionPointContainerVtbl *lpVtbl;
-    LONG ref;
-} IConnectionPointContainerImpl;
-
-extern IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer;
-
-
-/**********************************************************************
  * IConnectionPoint declaration for SHDOCVW.DLL
  */
 typedef struct
Index: dlls/shdocvw/webbrowser.c
===================================================================
RCS file: /home/wine/wine/dlls/shdocvw/webbrowser.c,v
retrieving revision 1.18
diff -u -p -r1.18 webbrowser.c
--- dlls/shdocvw/webbrowser.c	9 Sep 2005 10:05:40 -0000	1.18
+++ dlls/shdocvw/webbrowser.c	9 Sep 2005 16:48:04 -0000
@@ -78,8 +78,8 @@ static HRESULT WINAPI WebBrowser_QueryIn
         TRACE("(%p)->(IID_IQuickActivate %p)\n", This, ppv);
         *ppv = QUICKACT(This);
     }else if(IsEqualGUID (&IID_IConnectionPointContainer, riid)) {
-        FIXME("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
-        *ppv = &SHDOCVW_ConnectionPointContainer;
+        TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
+        *ppv = CONPTCONT(This);
     }
 
     if(*ppv) {
@@ -388,6 +388,7 @@ HRESULT WebBrowser_Create(IUnknown *pOut
     WebBrowser_Persist_Init(ret);
     WebBrowser_ClassInfo_Init(ret);
     WebBrowser_Misc_Init(ret);
+    WebBrowser_Events_Init(ret);
 
     hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
     if(SUCCEEDED(hres)) {


More information about the wine-patches mailing list