Make IProvideClassInfo2 interface heap based.

This commit is contained in:
Jacek Caban 2005-09-08 18:55:50 +00:00 committed by Alexandre Julliard
parent 613cf57872
commit 09d9f4293c
3 changed files with 42 additions and 121 deletions

View File

@ -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,
#define CLASSINFO_THIS(iface) DEFINE_THIS(WebBrowser, ProvideClassInfo, iface)
static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideClassInfo2 *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;
WebBrowser *This = CLASSINFO_THIS(iface);
return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
}
static ULONG WINAPI WBPCI_AddRef(LPPROVIDECLASSINFO iface)
static ULONG WINAPI ProvideClassInfo_AddRef(IProvideClassInfo2 *iface)
{
SHDOCVW_LockModule();
return 2; /* non-heap based object */
WebBrowser *This = CLASSINFO_THIS(iface);
return IWebBrowser_AddRef(WEBBROWSER(This));
}
static ULONG WINAPI WBPCI_Release(LPPROVIDECLASSINFO iface)
static ULONG WINAPI ProvideClassInfo_Release(IProvideClassInfo2 *iface)
{
SHDOCVW_UnlockModule();
return 1; /* non-heap based object */
WebBrowser *This = CLASSINFO_THIS(iface);
return IWebBrowser_Release(WEBBROWSER(This));
}
/* Return an ITypeInfo interface to retrieve type library info about
* this control.
*/
static HRESULT WINAPI WBPCI_GetClassInfo(LPPROVIDECLASSINFO iface, LPTYPEINFO *ppTI)
static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideClassInfo2 *iface, LPTYPEINFO *ppTI)
{
FIXME("stub: LPTYPEINFO = %p\n", *ppTI);
return S_OK;
}
/**********************************************************************
* 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));
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_GetClassInfo(LPPROVIDECLASSINFO2 iface, LPTYPEINFO
* an event sink (callback implementation in the OLE control site)
* to this control.
*/
static HRESULT WINAPI WBPCI2_GetGUID(LPPROVIDECLASSINFO2 iface,
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(LPPROVIDECLASSINFO2 iface,
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;
}

View File

@ -59,6 +59,7 @@ typedef struct {
const IOleControlVtbl *lpOleControlVtbl;
const IPersistStorageVtbl *lpPersistStorageVtbl;
const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
const IProvideClassInfo2Vtbl *lpProvideClassInfoVtbl;
LONG ref;
} WebBrowser;
@ -69,37 +70,14 @@ 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
*/

View File

@ -69,11 +69,11 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser *iface, REFIID riid,
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 *pOuter, REFIID riid, void **ppv)
WebBrowser_OleObject_Init(ret);
WebBrowser_Persist_Init(ret);
WebBrowser_ClassInfo_Init(ret);
hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
if(SUCCEEDED(hres)) {