SHDOCVW: Make IProvideClassInfo2 interface heap based

Jacek Caban jack at itma.pwr.wroc.pl
Thu Sep 8 10:01:32 CDT 2005


Changelog:
    Make IProvideClassInfo2 interface heap based
-------------- next part --------------
Index: dlls/shdocvw/classinfo.c
===================================================================
RCS file: /home/wine/wine/dlls/shdocvw/classinfo.c,v
retrieving revision 1.15
diff -u -p -r1.15 classinfo.c
--- dlls/shdocvw/classinfo.c	6 Jun 2005 19:50:36 -0000	1.15
+++ dlls/shdocvw/classinfo.c	8 Sep 2005 14:56:14 -0000
@@ -1,5 +1,5 @@
 /*
- * Implementation of IProvideClassInfo interfaces for IE Web Browser control
+ * Implementation of IProvideClassInfo interfaces for WebBrowser control
  *
  * Copyright 2001 John R. Sheets (for CodeWeavers)
  *
@@ -29,96 +29,35 @@
 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
 
 /**********************************************************************
- * Implement the IProvideClassInfo interface
- *
- * FIXME: Should we just pass in the IProvideClassInfo2 methods rather
- *        reimplementing them here?
+ * Implement the IProvideClassInfo2 interface
  */
 
-static HRESULT WINAPI WBPCI_QueryInterface(LPPROVIDECLASSINFO iface,
-                                           REFIID riid, LPVOID *ppobj)
-{
-    FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
-
-    if (ppobj == NULL) return E_POINTER;
-
-    return E_NOINTERFACE;
-}
+#define CLASSINFO_THIS(iface) DEFINE_THIS(WebBrowser, ProvideClassInfo, iface)
 
-static ULONG WINAPI WBPCI_AddRef(LPPROVIDECLASSINFO iface)
+static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideClassInfo2 *iface,
+        REFIID riid, LPVOID *ppobj)
 {
-    SHDOCVW_LockModule();
-
-    return 2; /* non-heap based object */
+    WebBrowser *This = CLASSINFO_THIS(iface);
+    return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
 }
 
-static ULONG WINAPI WBPCI_Release(LPPROVIDECLASSINFO iface)
+static ULONG WINAPI ProvideClassInfo_AddRef(IProvideClassInfo2 *iface)
 {
-    SHDOCVW_UnlockModule();
-
-    return 1; /* non-heap based object */
+    WebBrowser *This = CLASSINFO_THIS(iface);
+    return IWebBrowser_AddRef(WEBBROWSER(This));
 }
 
-/* Return an ITypeInfo interface to retrieve type library info about
- * this control.
- */
-static HRESULT WINAPI WBPCI_GetClassInfo(LPPROVIDECLASSINFO iface, LPTYPEINFO *ppTI)
+static ULONG WINAPI ProvideClassInfo_Release(IProvideClassInfo2 *iface)
 {
-    FIXME("stub: LPTYPEINFO = %p\n", *ppTI);
-    return S_OK;
+    WebBrowser *This = CLASSINFO_THIS(iface);
+    return IWebBrowser_Release(WEBBROWSER(This));
 }
 
-/**********************************************************************
- * IProvideClassInfo virtual function table for IE Web Browser component
- */
-
-static const IProvideClassInfoVtbl WBPCI_Vtbl =
-{
-    WBPCI_QueryInterface,
-    WBPCI_AddRef,
-    WBPCI_Release,
-    WBPCI_GetClassInfo
-};
-
-IProvideClassInfoImpl SHDOCVW_ProvideClassInfo = { &WBPCI_Vtbl};
-
-
-/**********************************************************************
- * Implement the IProvideClassInfo2 interface (inherits from
- * IProvideClassInfo).
- */
-
-static HRESULT WINAPI WBPCI2_QueryInterface(LPPROVIDECLASSINFO2 iface,
-                                            REFIID riid, LPVOID *ppobj)
+static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideClassInfo2 *iface, LPTYPEINFO *ppTI)
 {
-    FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
-
-    if (ppobj == NULL) return E_POINTER;
-    
-    return E_NOINTERFACE;
-}
-
-static ULONG WINAPI WBPCI2_AddRef(LPPROVIDECLASSINFO2 iface)
-{
-    SHDOCVW_LockModule();
-
-    return 2; /* non-heap based object */
-}
-
-static ULONG WINAPI WBPCI2_Release(LPPROVIDECLASSINFO2 iface)
-{
-    SHDOCVW_UnlockModule();
-
-    return 1; /* non-heap based object */
-}
-
-/* Return an ITypeInfo interface to retrieve type library info about
- * this control.
- */
-static HRESULT WINAPI WBPCI2_GetClassInfo(LPPROVIDECLASSINFO2 iface, LPTYPEINFO *ppTI)
-{
-    FIXME("stub: LPTYPEINFO = %p\n", *ppTI);
-    return S_OK;
+    WebBrowser *This = CLASSINFO_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, ppTI);
+    return E_NOTIMPL;
 }
 
 /* Get the IID for generic default event callbacks.  This IID will
@@ -126,10 +65,12 @@ static HRESULT WINAPI WBPCI2_GetClassInf
  * an event sink (callback implementation in the OLE control site)
  * to this control.
 */
-static HRESULT WINAPI WBPCI2_GetGUID(LPPROVIDECLASSINFO2 iface,
-                                     DWORD dwGuidKind, GUID *pGUID)
+static HRESULT WINAPI ProvideClassInfo_GetGUID(IProvideClassInfo2 *iface,
+        DWORD dwGuidKind, GUID *pGUID)
 {
-    FIXME("stub: dwGuidKind = %ld, pGUID = %s\n", dwGuidKind, debugstr_guid(pGUID));
+    WebBrowser *This = CLASSINFO_THIS(iface);
+
+    FIXME("(%p)->(%ld %p)\n", This, dwGuidKind, pGUID);
 
     if (dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID)
     {
@@ -150,17 +91,18 @@ static HRESULT WINAPI WBPCI2_GetGUID(LPP
     return S_OK;
 }
 
-/**********************************************************************
- * IProvideClassInfo virtual function table for IE Web Browser component
- */
+#undef CLASSINFO_THIS
 
-static const IProvideClassInfo2Vtbl WBPCI2_Vtbl =
+static const IProvideClassInfo2Vtbl ProvideClassInfoVtbl =
 {
-    WBPCI2_QueryInterface,
-    WBPCI2_AddRef,
-    WBPCI2_Release,
-    WBPCI2_GetClassInfo,
-    WBPCI2_GetGUID
+    ProvideClassInfo_QueryInterface,
+    ProvideClassInfo_AddRef,
+    ProvideClassInfo_Release,
+    ProvideClassInfo_GetClassInfo,
+    ProvideClassInfo_GetGUID
 };
 
-IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2 = { &WBPCI2_Vtbl};
+void WebBrowser_ClassInfo_Init(WebBrowser *This)
+{
+    This->lpProvideClassInfoVtbl = &ProvideClassInfoVtbl;
+}
Index: dlls/shdocvw/shdocvw.h
===================================================================
RCS file: /home/wine/wine/dlls/shdocvw/shdocvw.h,v
retrieving revision 1.18
diff -u -p -r1.18 shdocvw.h
--- dlls/shdocvw/shdocvw.h	8 Sep 2005 11:01:57 -0000	1.18
+++ dlls/shdocvw/shdocvw.h	8 Sep 2005 14:56:14 -0000
@@ -59,6 +59,7 @@ typedef struct {
     const IOleControlVtbl         *lpOleControlVtbl;
     const IPersistStorageVtbl     *lpPersistStorageVtbl;
     const IPersistStreamInitVtbl  *lpPersistStreamInitVtbl;
+    const IProvideClassInfo2Vtbl  *lpProvideClassInfoVtbl;
 
     LONG ref;
 } WebBrowser;
@@ -69,38 +70,15 @@ typedef struct {
 #define CONTROL(x)      ((IOleControl*)         &(x)->lpOleControlVtbl)
 #define PERSTORAGE(x)   ((IPersistStorage*)     &(x)->lpPersistStorageVtbl)
 #define PERSTRINIT(x)   ((IPersistStreamInit*)  &(x)->lpPersistStreamInitVtbl)
+#define CLASSINFO(x)    ((IProvideClassInfo2*)  &(x)->lpProvideClassInfoVtbl)
 
 void WebBrowser_OleObject_Init(WebBrowser*);
 void WebBrowser_Persist_Init(WebBrowser*);
+void WebBrowser_ClassInfo_Init(WebBrowser*);
 
 HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
 
 /**********************************************************************
- * IProvideClassInfo declaration for SHDOCVW.DLL
- */
-typedef struct
-{
-    /* IUnknown fields */
-    const IProvideClassInfoVtbl *lpVtbl;
-    LONG ref;
-} IProvideClassInfoImpl;
-
-extern IProvideClassInfoImpl SHDOCVW_ProvideClassInfo;
-
-
-/**********************************************************************
- * IProvideClassInfo2 declaration for SHDOCVW.DLL
- */
-typedef struct
-{
-    /* IUnknown fields */
-    const IProvideClassInfo2Vtbl *lpVtbl;
-    LONG ref;
-} IProvideClassInfo2Impl;
-
-extern IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2;
-
-/**********************************************************************
  * IQuickActivate declaration for SHDOCVW.DLL
  */
 typedef struct
Index: dlls/shdocvw/webbrowser.c
===================================================================
RCS file: /home/wine/wine/dlls/shdocvw/webbrowser.c,v
retrieving revision 1.16
diff -u -p -r1.16 webbrowser.c
--- dlls/shdocvw/webbrowser.c	8 Sep 2005 11:01:57 -0000	1.16
+++ dlls/shdocvw/webbrowser.c	8 Sep 2005 14:56:14 -0000
@@ -69,11 +69,11 @@ static HRESULT WINAPI WebBrowser_QueryIn
         TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
         *ppv = PERSTRINIT(This);
     }else if(IsEqualGUID (&IID_IProvideClassInfo, riid)) {
-        FIXME("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv);
-        *ppv = &SHDOCVW_ProvideClassInfo;
+        TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv);
+        *ppv = CLASSINFO(This);
     }else if(IsEqualGUID (&IID_IProvideClassInfo2, riid)) {
-        FIXME("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv);
-        *ppv = &SHDOCVW_ProvideClassInfo2;
+        TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv);
+        *ppv = CLASSINFO(This);
     }else if(IsEqualGUID (&IID_IQuickActivate, riid)) {
         FIXME("(%p)->(IID_IQuickActivate %p)\n", This, ppv);
         *ppv = &SHDOCVW_QuickActivate;
@@ -386,6 +386,7 @@ HRESULT WebBrowser_Create(IUnknown *pOut
 
     WebBrowser_OleObject_Init(ret);
     WebBrowser_Persist_Init(ret);
+    WebBrowser_ClassInfo_Init(ret);
 
     hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
     if(SUCCEEDED(hres)) {


More information about the wine-patches mailing list