diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index bbd276bd97f..90cafd7272d 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1731,13 +1731,13 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv) *ppv = &This->IHTMLDocument6_iface; }else if(IsEqualGUID(&IID_IPersist, riid)) { TRACE("(%p)->(IID_IPersist, %p)\n", This, ppv); - *ppv = PERSIST(This); + *ppv = &This->IPersistFile_iface; }else if(IsEqualGUID(&IID_IPersistMoniker, riid)) { TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This, ppv); - *ppv = PERSISTMON(This); + *ppv = &This->IPersistMoniker_iface; }else if(IsEqualGUID(&IID_IPersistFile, riid)) { TRACE("(%p)->(IID_IPersistFile, %p)\n", This, ppv); - *ppv = PERSISTFILE(This); + *ppv = &This->IPersistFile_iface; }else if(IsEqualGUID(&IID_IMonikerProp, riid)) { TRACE("(%p)->(IID_IMonikerProp, %p)\n", This, ppv); *ppv = MONPROP(This); @@ -1788,7 +1788,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv) *ppv = CONPTCONT(&This->cp_container); }else if(IsEqualGUID(&IID_IPersistStreamInit, riid)) { TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv); - *ppv = PERSTRINIT(This); + *ppv = &This->IPersistStreamInit_iface; }else if(IsEqualGUID(&DIID_DispHTMLDocument, riid)) { TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This, ppv); *ppv = &This->IHTMLDocument2_iface; @@ -1797,7 +1797,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv) *ppv = SUPPERRINFO(This); }else if(IsEqualGUID(&IID_IPersistHistory, riid)) { TRACE("(%p)->(IID_IPersistHistory %p)\n", This, ppv); - *ppv = PERSISTHIST(This); + *ppv = &This->IPersistHistory_iface; }else if(IsEqualGUID(&CLSID_CMarkup, riid)) { FIXME("(%p)->(CLSID_CMarkup %p)\n", This, ppv); *ppv = NULL; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index e83ba7b3b09..9059dedf4aa 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -347,9 +347,9 @@ struct HTMLDocument { IHTMLDocument4 IHTMLDocument4_iface; IHTMLDocument5 IHTMLDocument5_iface; IHTMLDocument6 IHTMLDocument6_iface; - const IPersistMonikerVtbl *lpPersistMonikerVtbl; - const IPersistFileVtbl *lpPersistFileVtbl; - const IPersistHistoryVtbl *lpPersistHistoryVtbl; + IPersistMoniker IPersistMoniker_iface; + IPersistFile IPersistFile_iface; + IPersistHistory IPersistHistory_iface; const IMonikerPropVtbl *lpMonikerPropVtbl; const IOleObjectVtbl *lpOleObjectVtbl; const IOleDocumentVtbl *lpOleDocumentVtbl; @@ -361,7 +361,7 @@ struct HTMLDocument { const IOleCommandTargetVtbl *lpOleCommandTargetVtbl; const IOleControlVtbl *lpOleControlVtbl; const IHlinkTargetVtbl *lpHlinkTargetVtbl; - const IPersistStreamInitVtbl *lpPersistStreamInitVtbl; + IPersistStreamInit IPersistStreamInit_iface; const IDispatchExVtbl *lpIDispatchExVtbl; const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl; const IObjectWithSiteVtbl *lpObjectWithSiteVtbl; @@ -626,9 +626,6 @@ struct HTMLDocumentNode { #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl) #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl) -#define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl) -#define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl) -#define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl) #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl) #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl) #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl) @@ -645,8 +642,6 @@ struct HTMLDocumentNode { #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl) #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl) #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl) -#define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl) -#define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl) #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl) #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl) diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c index 3fbe309c35d..8142d728d01 100644 --- a/dlls/mshtml/olecmd.c +++ b/dlls/mshtml/olecmd.c @@ -604,7 +604,7 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, } } - hres = IPersistMoniker_Load(PERSISTMON(This), TRUE, mon, NULL, 0); + hres = IPersistMoniker_Load(&This->IPersistMoniker_iface, TRUE, mon, NULL, 0); IMoniker_Release(mon); if(FAILED(hres)) return hres; diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 59e8bfc8f8d..46d00a3a449 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -339,45 +339,48 @@ static HRESULT get_doc_string(HTMLDocumentNode *This, char **str) * IPersistMoniker implementation */ -#define PERSISTMON_THIS(iface) DEFINE_THIS(HTMLDocument, PersistMoniker, iface) +static inline HTMLDocument *impl_from_IPersistMoniker(IPersistMoniker *iface) +{ + return CONTAINING_RECORD(iface, HTMLDocument, IPersistMoniker_iface); +} static HRESULT WINAPI PersistMoniker_QueryInterface(IPersistMoniker *iface, REFIID riid, void **ppv) { - HTMLDocument *This = PERSISTMON_THIS(iface); + HTMLDocument *This = impl_from_IPersistMoniker(iface); return htmldoc_query_interface(This, riid, ppv); } static ULONG WINAPI PersistMoniker_AddRef(IPersistMoniker *iface) { - HTMLDocument *This = PERSISTMON_THIS(iface); + HTMLDocument *This = impl_from_IPersistMoniker(iface); return htmldoc_addref(This); } static ULONG WINAPI PersistMoniker_Release(IPersistMoniker *iface) { - HTMLDocument *This = PERSISTMON_THIS(iface); + HTMLDocument *This = impl_from_IPersistMoniker(iface); return htmldoc_release(This); } static HRESULT WINAPI PersistMoniker_GetClassID(IPersistMoniker *iface, CLSID *pClassID) { - HTMLDocument *This = PERSISTMON_THIS(iface); - return IPersist_GetClassID(PERSIST(This), pClassID); + HTMLDocument *This = impl_from_IPersistMoniker(iface); + return IPersist_GetClassID(&This->IPersistFile_iface, pClassID); } static HRESULT WINAPI PersistMoniker_IsDirty(IPersistMoniker *iface) { - HTMLDocument *This = PERSISTMON_THIS(iface); + HTMLDocument *This = impl_from_IPersistMoniker(iface); TRACE("(%p)\n", This); - return IPersistStreamInit_IsDirty(PERSTRINIT(This)); + return IPersistStreamInit_IsDirty(&This->IPersistStreamInit_iface); } static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAvailable, IMoniker *pimkName, LPBC pibc, DWORD grfMode) { - HTMLDocument *This = PERSISTMON_THIS(iface); + HTMLDocument *This = impl_from_IPersistMoniker(iface); HRESULT hres; TRACE("(%p)->(%x %p %p %08x)\n", This, fFullyAvailable, pimkName, pibc, grfMode); @@ -421,21 +424,21 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva static HRESULT WINAPI PersistMoniker_Save(IPersistMoniker *iface, IMoniker *pimkName, LPBC pbc, BOOL fRemember) { - HTMLDocument *This = PERSISTMON_THIS(iface); + HTMLDocument *This = impl_from_IPersistMoniker(iface); FIXME("(%p)->(%p %p %x)\n", This, pimkName, pbc, fRemember); return E_NOTIMPL; } static HRESULT WINAPI PersistMoniker_SaveCompleted(IPersistMoniker *iface, IMoniker *pimkName, LPBC pibc) { - HTMLDocument *This = PERSISTMON_THIS(iface); + HTMLDocument *This = impl_from_IPersistMoniker(iface); FIXME("(%p)->(%p %p)\n", This, pimkName, pibc); return E_NOTIMPL; } static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoniker **ppimkName) { - HTMLDocument *This = PERSISTMON_THIS(iface); + HTMLDocument *This = impl_from_IPersistMoniker(iface); TRACE("(%p)->(%p)\n", This, ppimkName); @@ -517,29 +520,32 @@ static const IMonikerPropVtbl MonikerPropVtbl = { * IPersistFile implementation */ -#define PERSISTFILE_THIS(iface) DEFINE_THIS(HTMLDocument, PersistFile, iface) +static inline HTMLDocument *impl_from_IPersistFile(IPersistFile *iface) +{ + return CONTAINING_RECORD(iface, HTMLDocument, IPersistFile_iface); +} static HRESULT WINAPI PersistFile_QueryInterface(IPersistFile *iface, REFIID riid, void **ppv) { - HTMLDocument *This = PERSISTFILE_THIS(iface); + HTMLDocument *This = impl_from_IPersistFile(iface); return htmldoc_query_interface(This, riid, ppv); } static ULONG WINAPI PersistFile_AddRef(IPersistFile *iface) { - HTMLDocument *This = PERSISTFILE_THIS(iface); + HTMLDocument *This = impl_from_IPersistFile(iface); return htmldoc_addref(This); } static ULONG WINAPI PersistFile_Release(IPersistFile *iface) { - HTMLDocument *This = PERSISTFILE_THIS(iface); + HTMLDocument *This = impl_from_IPersistFile(iface); return htmldoc_release(This); } static HRESULT WINAPI PersistFile_GetClassID(IPersistFile *iface, CLSID *pClassID) { - HTMLDocument *This = PERSISTFILE_THIS(iface); + HTMLDocument *This = impl_from_IPersistFile(iface); TRACE("(%p)->(%p)\n", This, pClassID); @@ -552,23 +558,23 @@ static HRESULT WINAPI PersistFile_GetClassID(IPersistFile *iface, CLSID *pClassI static HRESULT WINAPI PersistFile_IsDirty(IPersistFile *iface) { - HTMLDocument *This = PERSISTFILE_THIS(iface); + HTMLDocument *This = impl_from_IPersistFile(iface); TRACE("(%p)\n", This); - return IPersistStreamInit_IsDirty(PERSTRINIT(This)); + return IPersistStreamInit_IsDirty(&This->IPersistStreamInit_iface); } static HRESULT WINAPI PersistFile_Load(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode) { - HTMLDocument *This = PERSISTFILE_THIS(iface); + HTMLDocument *This = impl_from_IPersistFile(iface); FIXME("(%p)->(%s %08x)\n", This, debugstr_w(pszFileName), dwMode); return E_NOTIMPL; } static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember) { - HTMLDocument *This = PERSISTFILE_THIS(iface); + HTMLDocument *This = impl_from_IPersistFile(iface); char *str; DWORD written=0; HANDLE file; @@ -593,14 +599,14 @@ static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileNam static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName) { - HTMLDocument *This = PERSISTFILE_THIS(iface); + HTMLDocument *This = impl_from_IPersistFile(iface); FIXME("(%p)->(%s)\n", This, debugstr_w(pszFileName)); return E_NOTIMPL; } static HRESULT WINAPI PersistFile_GetCurFile(IPersistFile *iface, LPOLESTR *pszFileName) { - HTMLDocument *This = PERSISTFILE_THIS(iface); + HTMLDocument *This = impl_from_IPersistFile(iface); FIXME("(%p)->(%p)\n", This, pszFileName); return E_NOTIMPL; } @@ -617,36 +623,39 @@ static const IPersistFileVtbl PersistFileVtbl = { PersistFile_GetCurFile }; -#define PERSTRINIT_THIS(iface) DEFINE_THIS(HTMLDocument, PersistStreamInit, iface) +static inline HTMLDocument *impl_from_IPersistStreamInit(IPersistStreamInit *iface) +{ + return CONTAINING_RECORD(iface, HTMLDocument, IPersistStreamInit_iface); +} static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface, REFIID riid, void **ppv) { - HTMLDocument *This = PERSTRINIT_THIS(iface); + HTMLDocument *This = impl_from_IPersistStreamInit(iface); return htmldoc_query_interface(This, riid, ppv); } static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface) { - HTMLDocument *This = PERSTRINIT_THIS(iface); + HTMLDocument *This = impl_from_IPersistStreamInit(iface); return htmldoc_addref(This); } static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface) { - HTMLDocument *This = PERSTRINIT_THIS(iface); + HTMLDocument *This = impl_from_IPersistStreamInit(iface); return htmldoc_release(This); } static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID) { - HTMLDocument *This = PERSTRINIT_THIS(iface); - return IPersist_GetClassID(PERSIST(This), pClassID); + HTMLDocument *This = impl_from_IPersistStreamInit(iface); + return IPersist_GetClassID(&This->IPersistFile_iface, pClassID); } static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface) { - HTMLDocument *This = PERSTRINIT_THIS(iface); + HTMLDocument *This = impl_from_IPersistStreamInit(iface); TRACE("(%p)\n", This); @@ -658,7 +667,7 @@ static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface) static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM pStm) { - HTMLDocument *This = PERSTRINIT_THIS(iface); + HTMLDocument *This = impl_from_IPersistStreamInit(iface); IMoniker *mon; HRESULT hres; @@ -683,7 +692,7 @@ static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStm, BOOL fClearDirty) { - HTMLDocument *This = PERSTRINIT_THIS(iface); + HTMLDocument *This = impl_from_IPersistStreamInit(iface); char *str; DWORD written=0; HRESULT hres; @@ -709,14 +718,14 @@ static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface, ULARGE_INTEGER *pcbSize) { - HTMLDocument *This = PERSTRINIT_THIS(iface); + HTMLDocument *This = impl_from_IPersistStreamInit(iface); FIXME("(%p)->(%p)\n", This, pcbSize); return E_NOTIMPL; } static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface) { - HTMLDocument *This = PERSTRINIT_THIS(iface); + HTMLDocument *This = impl_from_IPersistStreamInit(iface); IMoniker *mon; HRESULT hres; @@ -738,8 +747,6 @@ static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface) return channelbsc_load_stream(This->window->bscallback, NULL); } -#undef PERSTRINIT_THIS - static const IPersistStreamInitVtbl PersistStreamInitVtbl = { PersistStreamInit_QueryInterface, PersistStreamInit_AddRef, @@ -756,62 +763,63 @@ static const IPersistStreamInitVtbl PersistStreamInitVtbl = { * IPersistHistory implementation */ -#define PERSISTHIST_THIS(iface) DEFINE_THIS(HTMLDocument, PersistHistory, iface) +static inline HTMLDocument *impl_from_IPersistHistory(IPersistHistory *iface) +{ + return CONTAINING_RECORD(iface, HTMLDocument, IPersistHistory_iface); +} static HRESULT WINAPI PersistHistory_QueryInterface(IPersistHistory *iface, REFIID riid, void **ppv) { - HTMLDocument *This = PERSISTHIST_THIS(iface); + HTMLDocument *This = impl_from_IPersistHistory(iface); return htmldoc_query_interface(This, riid, ppv); } static ULONG WINAPI PersistHistory_AddRef(IPersistHistory *iface) { - HTMLDocument *This = PERSISTHIST_THIS(iface); + HTMLDocument *This = impl_from_IPersistHistory(iface); return htmldoc_addref(This); } static ULONG WINAPI PersistHistory_Release(IPersistHistory *iface) { - HTMLDocument *This = PERSISTHIST_THIS(iface); + HTMLDocument *This = impl_from_IPersistHistory(iface); return htmldoc_release(This); } static HRESULT WINAPI PersistHistory_GetClassID(IPersistHistory *iface, CLSID *pClassID) { - HTMLDocument *This = PERSISTHIST_THIS(iface); - return IPersist_GetClassID(PERSIST(This), pClassID); + HTMLDocument *This = impl_from_IPersistHistory(iface); + return IPersist_GetClassID(&This->IPersistFile_iface, pClassID); } static HRESULT WINAPI PersistHistory_LoadHistory(IPersistHistory *iface, IStream *pStream, IBindCtx *pbc) { - HTMLDocument *This = PERSISTHIST_THIS(iface); + HTMLDocument *This = impl_from_IPersistHistory(iface); FIXME("(%p)->(%p %p)\n", This, pStream, pbc); return E_NOTIMPL; } static HRESULT WINAPI PersistHistory_SaveHistory(IPersistHistory *iface, IStream *pStream) { - HTMLDocument *This = PERSISTHIST_THIS(iface); + HTMLDocument *This = impl_from_IPersistHistory(iface); FIXME("(%p)->(%p)\n", This, pStream); return E_NOTIMPL; } static HRESULT WINAPI PersistHistory_SetPositionCookie(IPersistHistory *iface, DWORD dwPositioncookie) { - HTMLDocument *This = PERSISTHIST_THIS(iface); + HTMLDocument *This = impl_from_IPersistHistory(iface); FIXME("(%p)->(%x)\n", This, dwPositioncookie); return E_NOTIMPL; } static HRESULT WINAPI PersistHistory_GetPositionCookie(IPersistHistory *iface, DWORD *pdwPositioncookie) { - HTMLDocument *This = PERSISTHIST_THIS(iface); + HTMLDocument *This = impl_from_IPersistHistory(iface); FIXME("(%p)->(%p)\n", This, pdwPositioncookie); return E_NOTIMPL; } -#undef PERSISTHIST_THIS - static const IPersistHistoryVtbl PersistHistoryVtbl = { PersistHistory_QueryInterface, PersistHistory_AddRef, @@ -825,9 +833,9 @@ static const IPersistHistoryVtbl PersistHistoryVtbl = { void HTMLDocument_Persist_Init(HTMLDocument *This) { - This->lpPersistMonikerVtbl = &PersistMonikerVtbl; - This->lpPersistFileVtbl = &PersistFileVtbl; + This->IPersistMoniker_iface.lpVtbl = &PersistMonikerVtbl; + This->IPersistFile_iface.lpVtbl = &PersistFileVtbl; This->lpMonikerPropVtbl = &MonikerPropVtbl; - This->lpPersistStreamInitVtbl = &PersistStreamInitVtbl; - This->lpPersistHistoryVtbl = &PersistHistoryVtbl; + This->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl; + This->IPersistHistory_iface.lpVtbl = &PersistHistoryVtbl; }