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