Commit e5b5eb69 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

Make IPersist* interfaces heap based.

parent 2312fdeb
/*
* Implementation of IPersist interfaces for IE Web Browser control
* Implementation of IPersist interfaces for WebBrowser control
*
* Copyright 2001 John R. Sheets (for CodeWeavers)
* Copyright 2005 Jacek Caban
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -27,168 +28,169 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
* Implement the IPersistStorage interface
*/
static HRESULT WINAPI WBPS_QueryInterface(LPPERSISTSTORAGE iface,
REFIID riid, LPVOID *ppobj)
{
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
#define PERSTORAGE_THIS(ifce) DEFINE_THIS(WebBrowser, PersistStorage, iface)
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
static HRESULT WINAPI PersistStorage_QueryInterface(IPersistStorage *iface,
REFIID riid, LPVOID *ppobj)
{
WebBrowser *This = PERSTORAGE_THIS(iface);
return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
}
static ULONG WINAPI WBPS_AddRef(LPPERSISTSTORAGE iface)
static ULONG WINAPI PersistStorage_AddRef(IPersistStorage *iface)
{
SHDOCVW_LockModule();
return 2; /* non-heap based object */
WebBrowser *This = PERSTORAGE_THIS(iface);
return IWebBrowser_AddRef(WEBBROWSER(This));
}
static ULONG WINAPI WBPS_Release(LPPERSISTSTORAGE iface)
static ULONG WINAPI PersistStorage_Release(IPersistStorage *iface)
{
SHDOCVW_UnlockModule();
return 1; /* non-heap based object */
WebBrowser *This = PERSTORAGE_THIS(iface);
return IWebBrowser_Release(WEBBROWSER(This));
}
static HRESULT WINAPI WBPS_GetClassID(LPPERSISTSTORAGE iface, CLSID *pClassID)
static HRESULT WINAPI PersistStorage_GetClassID(IPersistStorage *iface, CLSID *pClassID)
{
FIXME("stub: CLSID = %s\n", debugstr_guid(pClassID));
return S_OK;
WebBrowser *This = PERSTORAGE_THIS(iface);
FIXME("(%p)->(%p)\n", This, pClassID);
return E_NOTIMPL;
}
static HRESULT WINAPI WBPS_IsDirty(LPPERSISTSTORAGE iface)
static HRESULT WINAPI PersistStorage_IsDirty(IPersistStorage *iface)
{
FIXME("stub\n");
return S_OK;
WebBrowser *This = PERSTORAGE_THIS(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI WBPS_InitNew(LPPERSISTSTORAGE iface, LPSTORAGE pStg)
static HRESULT WINAPI PersistStorage_InitNew(IPersistStorage *iface, LPSTORAGE pStg)
{
FIXME("stub: LPSTORAGE = %p\n", pStg);
return S_OK;
WebBrowser *This = PERSTORAGE_THIS(iface);
FIXME("(%p)->(%p)\n", This, pStg);
return E_NOTIMPL;
}
static HRESULT WINAPI WBPS_Load(LPPERSISTSTORAGE iface, LPSTORAGE pStg)
static HRESULT WINAPI PersistStorage_Load(IPersistStorage *iface, LPSTORAGE pStg)
{
FIXME("stub: LPSTORAGE = %p\n", pStg);
return S_OK;
WebBrowser *This = PERSTORAGE_THIS(iface);
FIXME("(%p)->(%p)\n", This, pStg);
return E_NOTIMPL;
}
static HRESULT WINAPI WBPS_Save(LPPERSISTSTORAGE iface, LPSTORAGE pStg,
BOOL fSameAsLoad)
static HRESULT WINAPI PersistStorage_Save(IPersistStorage *iface, LPSTORAGE pStg,
BOOL fSameAsLoad)
{
FIXME("stub: LPSTORAGE = %p, fSameAsLoad = %d\n", pStg, fSameAsLoad);
return S_OK;
WebBrowser *This = PERSTORAGE_THIS(iface);
FIXME("(%p)->(%p %x)\n", This, pStg, fSameAsLoad);
return E_NOTIMPL;
}
static HRESULT WINAPI WBPS_SaveCompleted(LPPERSISTSTORAGE iface, LPSTORAGE pStgNew)
static HRESULT WINAPI PersistStorage_SaveCompleted(IPersistStorage *iface, LPSTORAGE pStgNew)
{
FIXME("stub: LPSTORAGE = %p\n", pStgNew);
return S_OK;
WebBrowser *This = PERSTORAGE_THIS(iface);
FIXME("(%p)->(%p)\n", This, pStgNew);
return E_NOTIMPL;
}
/**********************************************************************
* IPersistStorage virtual function table for IE Web Browser component
*/
#define PERSTORAGE_THIS(ifce) DEFINE_THIS(WebBrowser, PersistStorage, iface)
static const IPersistStorageVtbl WBPS_Vtbl =
{
WBPS_QueryInterface,
WBPS_AddRef,
WBPS_Release,
WBPS_GetClassID,
WBPS_IsDirty,
WBPS_InitNew,
WBPS_Load,
WBPS_Save,
WBPS_SaveCompleted
static const IPersistStorageVtbl PersistStorageVtbl =
{
PersistStorage_QueryInterface,
PersistStorage_AddRef,
PersistStorage_Release,
PersistStorage_GetClassID,
PersistStorage_IsDirty,
PersistStorage_InitNew,
PersistStorage_Load,
PersistStorage_Save,
PersistStorage_SaveCompleted
};
IPersistStorageImpl SHDOCVW_PersistStorage = {&WBPS_Vtbl};
/**********************************************************************
* Implement the IPersistStreamInit interface
*/
static HRESULT WINAPI WBPSI_QueryInterface(LPPERSISTSTREAMINIT iface,
REFIID riid, LPVOID *ppobj)
{
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
#define PERSTRINIT_THIS(iface) DEFINE_THIS(WebBrowser, PersistStreamInit, iface)
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface,
REFIID riid, LPVOID *ppobj)
{
WebBrowser *This = PERSTRINIT_THIS(iface);
return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
}
static ULONG WINAPI WBPSI_AddRef(LPPERSISTSTREAMINIT iface)
static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
{
SHDOCVW_LockModule();
return 2; /* non-heap based object */
WebBrowser *This = PERSTRINIT_THIS(iface);
return IWebBrowser_AddRef(WEBBROWSER(This));
}
static ULONG WINAPI WBPSI_Release(LPPERSISTSTREAMINIT iface)
static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
{
SHDOCVW_UnlockModule();
return 1; /* non-heap based object */
WebBrowser *This = PERSTRINIT_THIS(iface);
return IWebBrowser_Release(WEBBROWSER(This));
}
static HRESULT WINAPI WBPSI_GetClassID(LPPERSISTSTREAMINIT iface, CLSID *pClassID)
static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID)
{
FIXME("stub: CLSID = %s\n", debugstr_guid(pClassID));
return S_OK;
WebBrowser *This = PERSTRINIT_THIS(iface);
return IPersistStorage_GetClassID(PERSTORAGE(This), pClassID);
}
static HRESULT WINAPI WBPSI_IsDirty(LPPERSISTSTREAMINIT iface)
static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
{
FIXME("stub\n");
return S_OK;
WebBrowser *This = PERSTRINIT_THIS(iface);
return IPersistStorage_IsDirty(PERSTORAGE(This));
}
static HRESULT WINAPI WBPSI_Load(LPPERSISTSTREAMINIT iface, LPSTREAM pStg)
static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM pStg)
{
FIXME("stub: LPSTORAGE = %p\n", pStg);
return S_OK;
WebBrowser *This = PERSTRINIT_THIS(iface);
FIXME("(%p)->(%p)\n", This, pStg);
return E_NOTIMPL;
}
static HRESULT WINAPI WBPSI_Save(LPPERSISTSTREAMINIT iface, LPSTREAM pStg,
BOOL fSameAsLoad)
static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStg,
BOOL fSameAsLoad)
{
FIXME("stub: LPSTORAGE = %p, fSameAsLoad = %d\n", pStg, fSameAsLoad);
return S_OK;
WebBrowser *This = PERSTRINIT_THIS(iface);
FIXME("(%p)->(%p %x)\n", This, pStg, fSameAsLoad);
return E_NOTIMPL;
}
static HRESULT WINAPI WBPSI_GetSizeMax(LPPERSISTSTREAMINIT iface,
ULARGE_INTEGER *pcbSize)
static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface,
ULARGE_INTEGER *pcbSize)
{
FIXME("stub: ULARGE_INTEGER = %p\n", pcbSize);
return S_OK;
WebBrowser *This = PERSTRINIT_THIS(iface);
FIXME("(%p)->(%p)\n", This, pcbSize);
return E_NOTIMPL;
}
static HRESULT WINAPI WBPSI_InitNew(LPPERSISTSTREAMINIT iface)
static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
{
FIXME("stub\n");
return S_OK;
WebBrowser *This = PERSTRINIT_THIS(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
/**********************************************************************
* IPersistStreamInit virtual function table for IE Web Browser component
*/
#undef PERSTRINIT_THIS
static const IPersistStreamInitVtbl WBPSI_Vtbl =
{
WBPSI_QueryInterface,
WBPSI_AddRef,
WBPSI_Release,
WBPSI_GetClassID,
WBPSI_IsDirty,
WBPSI_Load,
WBPSI_Save,
WBPSI_GetSizeMax,
WBPSI_InitNew
static const IPersistStreamInitVtbl PersistStreamInitVtbl =
{
PersistStreamInit_QueryInterface,
PersistStreamInit_AddRef,
PersistStreamInit_Release,
PersistStreamInit_GetClassID,
PersistStreamInit_IsDirty,
PersistStreamInit_Load,
PersistStreamInit_Save,
PersistStreamInit_GetSizeMax,
PersistStreamInit_InitNew
};
IPersistStreamInitImpl SHDOCVW_PersistStreamInit = {&WBPSI_Vtbl};
void WebBrowser_Persist_Init(WebBrowser *This)
{
This->lpPersistStorageVtbl = &PersistStorageVtbl;
This->lpPersistStreamInitVtbl = &PersistStreamInitVtbl;
}
......@@ -53,10 +53,12 @@ extern IClassFactoryImpl SHDOCVW_ClassFactory;
* WebBrowser declaration for SHDOCVW.DLL
*/
typedef struct {
const IWebBrowserVtbl *lpWebBrowserVtbl;
const IOleObjectVtbl *lpOleObjectVtbl;
const IOleInPlaceObjectVtbl *lpOleInPlaceObjectVtbl;
const IOleControlVtbl *lpOleControlVtbl;
const IWebBrowserVtbl *lpWebBrowserVtbl;
const IOleObjectVtbl *lpOleObjectVtbl;
const IOleInPlaceObjectVtbl *lpOleInPlaceObjectVtbl;
const IOleControlVtbl *lpOleControlVtbl;
const IPersistStorageVtbl *lpPersistStorageVtbl;
const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
LONG ref;
} WebBrowser;
......@@ -65,8 +67,11 @@ typedef struct {
#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)
void WebBrowser_OleObject_Init(WebBrowser*);
void WebBrowser_Persist_Init(WebBrowser*);
HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
......@@ -95,33 +100,6 @@ typedef struct
extern IProvideClassInfo2Impl SHDOCVW_ProvideClassInfo2;
/**********************************************************************
* IPersistStorage declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
const IPersistStorageVtbl *lpVtbl;
LONG ref;
} IPersistStorageImpl;
extern IPersistStorageImpl SHDOCVW_PersistStorage;
/**********************************************************************
* IPersistStreamInit declaration for SHDOCVW.DLL
*/
typedef struct
{
/* IUnknown fields */
const IPersistStreamInitVtbl *lpVtbl;
LONG ref;
} IPersistStreamInitImpl;
extern IPersistStreamInitImpl SHDOCVW_PersistStreamInit;
/**********************************************************************
* IQuickActivate declaration for SHDOCVW.DLL
*/
......
......@@ -56,15 +56,18 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser *iface, REFIID riid,
}else if(IsEqualGUID (&IID_IOleInPlaceObject, riid)) {
TRACE("(%p)->(IID_IOleInPlaceObject %p)\n", This, ppv);
*ppv = INPLACEOBJ(This);
}else if(IsEqualGUID (&IID_IOleControl, riid)) {
FIXME("(%p)->(IID_IOleControl %p)\n", This, ppv);
}else if(IsEqualGUID(&IID_IOleControl, riid)) {
TRACE("(%p)->(IID_IOleControl %p)\n", This, ppv);
*ppv = CONTROL(This);
}else if(IsEqualGUID (&IID_IPersistStorage, riid)) {
FIXME("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
*ppv = &SHDOCVW_PersistStorage;
}else if(IsEqualGUID(&IID_IPersist, riid)) {
TRACE("(%p)->(IID_IPersist %p)\n", This, ppv);
*ppv = PERSTORAGE(This);
}else if(IsEqualGUID(&IID_IPersistStorage, riid)) {
TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
*ppv = PERSTORAGE(This);
}else if(IsEqualGUID (&IID_IPersistStreamInit, riid)) {
FIXME("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
*ppv = &SHDOCVW_PersistStreamInit;
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;
......@@ -382,6 +385,7 @@ HRESULT WebBrowser_Create(IUnknown *pOuter, REFIID riid, void **ppv)
ret->ref = 0;
WebBrowser_OleObject_Init(ret);
WebBrowser_Persist_Init(ret);
hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
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