Commit 09d9f429 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

Make IProvideClassInfo2 interface heap based.

parent 613cf578
/* /*
* Implementation of IProvideClassInfo interfaces for IE Web Browser control * Implementation of IProvideClassInfo interfaces for WebBrowser control
* *
* Copyright 2001 John R. Sheets (for CodeWeavers) * Copyright 2001 John R. Sheets (for CodeWeavers)
* *
...@@ -29,96 +29,35 @@ ...@@ -29,96 +29,35 @@
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
/********************************************************************** /**********************************************************************
* Implement the IProvideClassInfo interface * Implement the IProvideClassInfo2 interface
*
* FIXME: Should we just pass in the IProvideClassInfo2 methods rather
* reimplementing them here?
*/ */
static HRESULT WINAPI WBPCI_QueryInterface(LPPROVIDECLASSINFO iface, #define CLASSINFO_THIS(iface) DEFINE_THIS(WebBrowser, ProvideClassInfo, 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;
}
static ULONG WINAPI WBPCI_AddRef(LPPROVIDECLASSINFO iface) static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideClassInfo2 *iface,
REFIID riid, LPVOID *ppobj)
{ {
SHDOCVW_LockModule(); WebBrowser *This = CLASSINFO_THIS(iface);
return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
return 2; /* non-heap based object */
} }
static ULONG WINAPI WBPCI_Release(LPPROVIDECLASSINFO iface) static ULONG WINAPI ProvideClassInfo_AddRef(IProvideClassInfo2 *iface)
{ {
SHDOCVW_UnlockModule(); WebBrowser *This = CLASSINFO_THIS(iface);
return IWebBrowser_AddRef(WEBBROWSER(This));
return 1; /* non-heap based object */
} }
/* Return an ITypeInfo interface to retrieve type library info about static ULONG WINAPI ProvideClassInfo_Release(IProvideClassInfo2 *iface)
* this control.
*/
static HRESULT WINAPI WBPCI_GetClassInfo(LPPROVIDECLASSINFO iface, LPTYPEINFO *ppTI)
{ {
FIXME("stub: LPTYPEINFO = %p\n", *ppTI); WebBrowser *This = CLASSINFO_THIS(iface);
return S_OK; return IWebBrowser_Release(WEBBROWSER(This));
} }
/********************************************************************** static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideClassInfo2 *iface, LPTYPEINFO *ppTI)
* 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)
{ {
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); WebBrowser *This = CLASSINFO_THIS(iface);
FIXME("(%p)->(%p)\n", This, ppTI);
if (ppobj == NULL) return E_POINTER; return E_NOTIMPL;
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;
} }
/* Get the IID for generic default event callbacks. This IID will /* Get the IID for generic default event callbacks. This IID will
...@@ -126,10 +65,12 @@ static HRESULT WINAPI WBPCI2_GetClassInfo(LPPROVIDECLASSINFO2 iface, LPTYPEINFO ...@@ -126,10 +65,12 @@ static HRESULT WINAPI WBPCI2_GetClassInfo(LPPROVIDECLASSINFO2 iface, LPTYPEINFO
* an event sink (callback implementation in the OLE control site) * an event sink (callback implementation in the OLE control site)
* to this control. * to this control.
*/ */
static HRESULT WINAPI WBPCI2_GetGUID(LPPROVIDECLASSINFO2 iface, static HRESULT WINAPI ProvideClassInfo_GetGUID(IProvideClassInfo2 *iface,
DWORD dwGuidKind, GUID *pGUID) 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) if (dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID)
{ {
...@@ -150,17 +91,18 @@ static HRESULT WINAPI WBPCI2_GetGUID(LPPROVIDECLASSINFO2 iface, ...@@ -150,17 +91,18 @@ static HRESULT WINAPI WBPCI2_GetGUID(LPPROVIDECLASSINFO2 iface,
return S_OK; return S_OK;
} }
/********************************************************************** #undef CLASSINFO_THIS
* IProvideClassInfo virtual function table for IE Web Browser component
*/
static const IProvideClassInfo2Vtbl WBPCI2_Vtbl = static const IProvideClassInfo2Vtbl ProvideClassInfoVtbl =
{ {
WBPCI2_QueryInterface, ProvideClassInfo_QueryInterface,
WBPCI2_AddRef, ProvideClassInfo_AddRef,
WBPCI2_Release, ProvideClassInfo_Release,
WBPCI2_GetClassInfo, ProvideClassInfo_GetClassInfo,
WBPCI2_GetGUID ProvideClassInfo_GetGUID
}; };
IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2 = { &WBPCI2_Vtbl}; void WebBrowser_ClassInfo_Init(WebBrowser *This)
{
This->lpProvideClassInfoVtbl = &ProvideClassInfoVtbl;
}
...@@ -59,6 +59,7 @@ typedef struct { ...@@ -59,6 +59,7 @@ typedef struct {
const IOleControlVtbl *lpOleControlVtbl; const IOleControlVtbl *lpOleControlVtbl;
const IPersistStorageVtbl *lpPersistStorageVtbl; const IPersistStorageVtbl *lpPersistStorageVtbl;
const IPersistStreamInitVtbl *lpPersistStreamInitVtbl; const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
const IProvideClassInfo2Vtbl *lpProvideClassInfoVtbl;
LONG ref; LONG ref;
} WebBrowser; } WebBrowser;
...@@ -69,38 +70,15 @@ typedef struct { ...@@ -69,38 +70,15 @@ typedef struct {
#define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl) #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
#define PERSTORAGE(x) ((IPersistStorage*) &(x)->lpPersistStorageVtbl) #define PERSTORAGE(x) ((IPersistStorage*) &(x)->lpPersistStorageVtbl)
#define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl) #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
#define CLASSINFO(x) ((IProvideClassInfo2*) &(x)->lpProvideClassInfoVtbl)
void WebBrowser_OleObject_Init(WebBrowser*); void WebBrowser_OleObject_Init(WebBrowser*);
void WebBrowser_Persist_Init(WebBrowser*); void WebBrowser_Persist_Init(WebBrowser*);
void WebBrowser_ClassInfo_Init(WebBrowser*);
HRESULT WebBrowser_Create(IUnknown*,REFIID,void**); 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 * IQuickActivate declaration for SHDOCVW.DLL
*/ */
typedef struct typedef struct
......
...@@ -69,11 +69,11 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser *iface, REFIID riid, ...@@ -69,11 +69,11 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser *iface, REFIID riid,
TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv); TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
*ppv = PERSTRINIT(This); *ppv = PERSTRINIT(This);
}else if(IsEqualGUID (&IID_IProvideClassInfo, riid)) { }else if(IsEqualGUID (&IID_IProvideClassInfo, riid)) {
FIXME("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv); TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv);
*ppv = &SHDOCVW_ProvideClassInfo; *ppv = CLASSINFO(This);
}else if(IsEqualGUID (&IID_IProvideClassInfo2, riid)) { }else if(IsEqualGUID (&IID_IProvideClassInfo2, riid)) {
FIXME("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv); TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv);
*ppv = &SHDOCVW_ProvideClassInfo2; *ppv = CLASSINFO(This);
}else if(IsEqualGUID (&IID_IQuickActivate, riid)) { }else if(IsEqualGUID (&IID_IQuickActivate, riid)) {
FIXME("(%p)->(IID_IQuickActivate %p)\n", This, ppv); FIXME("(%p)->(IID_IQuickActivate %p)\n", This, ppv);
*ppv = &SHDOCVW_QuickActivate; *ppv = &SHDOCVW_QuickActivate;
...@@ -386,6 +386,7 @@ HRESULT WebBrowser_Create(IUnknown *pOuter, REFIID riid, void **ppv) ...@@ -386,6 +386,7 @@ HRESULT WebBrowser_Create(IUnknown *pOuter, REFIID riid, void **ppv)
WebBrowser_OleObject_Init(ret); WebBrowser_OleObject_Init(ret);
WebBrowser_Persist_Init(ret); WebBrowser_Persist_Init(ret);
WebBrowser_ClassInfo_Init(ret);
hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv); hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment