From 7aa159275f86883fde21bc9a94c0adf12f3488ee Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 13 Nov 2010 17:48:34 +0100 Subject: [PATCH] shdocvw: Get rid of remaining *_THIS macros. --- dlls/shdocvw/client.c | 4 +-- dlls/shdocvw/events.c | 64 ++++++++++++++++++++------------------- dlls/shdocvw/frame.c | 61 +++++++++++++++++++------------------ dlls/shdocvw/ie.c | 2 +- dlls/shdocvw/iexplore.c | 7 ++++- dlls/shdocvw/shdocvw.h | 10 ++---- dlls/shdocvw/webbrowser.c | 13 ++++---- 7 files changed, 81 insertions(+), 80 deletions(-) diff --git a/dlls/shdocvw/client.c b/dlls/shdocvw/client.c index a11fdf6d8cd..dfb6d34e23e 100644 --- a/dlls/shdocvw/client.c +++ b/dlls/shdocvw/client.c @@ -220,8 +220,8 @@ static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSite *iface, TRACE("(%p)->(%p %p %p %p %p)\n", This, ppFrame, ppDoc, lprcPosRect, lprcClipRect, lpFrameInfo); - IOleInPlaceFrame_AddRef(INPLACEFRAME(This)); - *ppFrame = INPLACEFRAME(This); + IOleInPlaceFrame_AddRef(&This->IOleInPlaceFrame_iface); + *ppFrame = &This->IOleInPlaceFrame_iface; *ppDoc = NULL; GetClientRect(This->hwnd, lprcPosRect); diff --git a/dlls/shdocvw/events.c b/dlls/shdocvw/events.c index 85903595295..f431e0f59da 100644 --- a/dlls/shdocvw/events.c +++ b/dlls/shdocvw/events.c @@ -29,7 +29,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); struct ConnectionPoint { - const IConnectionPointVtbl *lpConnectionPointVtbl; + IConnectionPoint IConnectionPoint_iface; IConnectionPointContainer *container; @@ -39,37 +39,38 @@ struct ConnectionPoint { IID iid; }; -#define CONPOINT(x) ((IConnectionPoint*) &(x)->lpConnectionPointVtbl) - /********************************************************************** * Implement the IConnectionPointContainer interface */ -#define CONPTCONT_THIS(iface) DEFINE_THIS(ConnectionPointContainer, ConnectionPointContainer, iface) +static inline ConnectionPointContainer *impl_from_IConnectionPointContainer(IConnectionPointContainer *iface) +{ + return (ConnectionPointContainer*)((char*)iface - FIELD_OFFSET(ConnectionPointContainer, IConnectionPointContainer_iface)); +} static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface, REFIID riid, LPVOID *ppv) { - ConnectionPointContainer *This = CONPTCONT_THIS(iface); + ConnectionPointContainer *This = impl_from_IConnectionPointContainer(iface); return IUnknown_QueryInterface(This->impl, riid, ppv); } static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface) { - ConnectionPointContainer *This = CONPTCONT_THIS(iface); + ConnectionPointContainer *This = impl_from_IConnectionPointContainer(iface); return IUnknown_AddRef(This->impl); } static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface) { - ConnectionPointContainer *This = CONPTCONT_THIS(iface); + ConnectionPointContainer *This = impl_from_IConnectionPointContainer(iface); return IUnknown_Release(This->impl); } static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface, LPENUMCONNECTIONPOINTS *ppEnum) { - ConnectionPointContainer *This = CONPTCONT_THIS(iface); + ConnectionPointContainer *This = impl_from_IConnectionPointContainer(iface); FIXME("(%p)->(%p)\n", This, ppEnum); return E_NOTIMPL; } @@ -77,7 +78,7 @@ static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionP static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface, REFIID riid, LPCONNECTIONPOINT *ppCP) { - ConnectionPointContainer *This = CONPTCONT_THIS(iface); + ConnectionPointContainer *This = impl_from_IConnectionPointContainer(iface); if(!ppCP) { WARN("ppCP == NULL\n"); @@ -88,13 +89,13 @@ static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPo if(IsEqualGUID(&DIID_DWebBrowserEvents2, riid)) { TRACE("(%p)->(DIID_DWebBrowserEvents2 %p)\n", This, ppCP); - *ppCP = CONPOINT(This->wbe2); + *ppCP = &This->wbe2->IConnectionPoint_iface; }else if(IsEqualGUID(&DIID_DWebBrowserEvents, riid)) { TRACE("(%p)->(DIID_DWebBrowserEvents %p)\n", This, ppCP); - *ppCP = CONPOINT(This->wbe); + *ppCP = &This->wbe->IConnectionPoint_iface; }else if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) { TRACE("(%p)->(IID_IPropertyNotifySink %p)\n", This, ppCP); - *ppCP = CONPOINT(This->pns); + *ppCP = &This->pns->IConnectionPoint_iface; } if(*ppCP) { @@ -106,7 +107,7 @@ static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPo return CONNECT_E_NOCONNECTION; } -#undef CONPTCONT_THIS +#undef impl_from_IConnectionPointContainer static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = { @@ -122,21 +123,24 @@ static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = * Implement the IConnectionPoint interface */ -#define CONPOINT_THIS(iface) DEFINE_THIS(ConnectionPoint, ConnectionPoint, iface) +static inline ConnectionPoint *impl_from_IConnectionPoint(IConnectionPoint *iface) +{ + return (ConnectionPoint*)((char*)iface - FIELD_OFFSET(ConnectionPoint, IConnectionPoint_iface)); +} static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface, REFIID riid, LPVOID *ppv) { - ConnectionPoint *This = CONPOINT_THIS(iface); + ConnectionPoint *This = impl_from_IConnectionPoint(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = CONPOINT(This); + *ppv = &This->IConnectionPoint_iface; }else if(IsEqualGUID(&IID_IConnectionPoint, riid)) { TRACE("(%p)->(IID_IConnectionPoint %p)\n", This, ppv); - *ppv = CONPOINT(This); + *ppv = &This->IConnectionPoint_iface; } if(*ppv) { @@ -150,19 +154,19 @@ static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface, static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface) { - ConnectionPoint *This = CONPOINT_THIS(iface); + ConnectionPoint *This = impl_from_IConnectionPoint(iface); return IConnectionPointContainer_AddRef(This->container); } static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface) { - ConnectionPoint *This = CONPOINT_THIS(iface); + ConnectionPoint *This = impl_from_IConnectionPoint(iface); return IConnectionPointContainer_Release(This->container); } static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *pIID) { - ConnectionPoint *This = CONPOINT_THIS(iface); + ConnectionPoint *This = impl_from_IConnectionPoint(iface); TRACE("(%p)->(%p)\n", This, pIID); @@ -173,7 +177,7 @@ static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *i static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoint *iface, IConnectionPointContainer **ppCPC) { - ConnectionPoint *This = CONPOINT_THIS(iface); + ConnectionPoint *This = impl_from_IConnectionPoint(iface); TRACE("(%p)->(%p)\n", This, ppCPC); @@ -185,7 +189,7 @@ static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoi static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *pUnkSink, DWORD *pdwCookie) { - ConnectionPoint *This = CONPOINT_THIS(iface); + ConnectionPoint *This = impl_from_IConnectionPoint(iface); IDispatch *disp; DWORD i; HRESULT hres; @@ -222,7 +226,7 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown * static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dwCookie) { - ConnectionPoint *This = CONPOINT_THIS(iface); + ConnectionPoint *This = impl_from_IConnectionPoint(iface); TRACE("(%p)->(%d)\n", This, dwCookie); @@ -238,13 +242,11 @@ static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dw static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface, IEnumConnections **ppEnum) { - ConnectionPoint *This = CONPOINT_THIS(iface); + ConnectionPoint *This = impl_from_IConnectionPoint(iface); FIXME("(%p)->(%p)\n", This, ppEnum); return E_NOTIMPL; } -#undef CONPOINT_THIS - static const IConnectionPointVtbl ConnectionPointVtbl = { ConnectionPoint_QueryInterface, @@ -273,7 +275,7 @@ static void ConnectionPoint_Create(REFIID riid, ConnectionPoint **cp, { ConnectionPoint *ret = heap_alloc(sizeof(ConnectionPoint)); - ret->lpConnectionPointVtbl = &ConnectionPointVtbl; + ret->IConnectionPoint_iface.lpVtbl = &ConnectionPointVtbl; ret->sinks = NULL; ret->sinks_size = 0; @@ -299,11 +301,11 @@ static void ConnectionPoint_Destroy(ConnectionPoint *This) void ConnectionPointContainer_Init(ConnectionPointContainer *This, IUnknown *impl) { - This->lpConnectionPointContainerVtbl = &ConnectionPointContainerVtbl; + This->IConnectionPointContainer_iface.lpVtbl = &ConnectionPointContainerVtbl; - ConnectionPoint_Create(&DIID_DWebBrowserEvents2, &This->wbe2, CONPTCONT(This)); - ConnectionPoint_Create(&DIID_DWebBrowserEvents, &This->wbe, CONPTCONT(This)); - ConnectionPoint_Create(&IID_IPropertyNotifySink, &This->pns, CONPTCONT(This)); + ConnectionPoint_Create(&DIID_DWebBrowserEvents2, &This->wbe2, &This->IConnectionPointContainer_iface); + ConnectionPoint_Create(&DIID_DWebBrowserEvents, &This->wbe, &This->IConnectionPointContainer_iface); + ConnectionPoint_Create(&IID_IPropertyNotifySink, &This->pns, &This->IConnectionPointContainer_iface); This->impl = impl; } diff --git a/dlls/shdocvw/frame.c b/dlls/shdocvw/frame.c index f0bd0c25833..a1df0c35344 100644 --- a/dlls/shdocvw/frame.c +++ b/dlls/shdocvw/frame.c @@ -21,53 +21,54 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); -#define INPLACEFRAME_THIS(iface) DEFINE_THIS(DocHost, OleInPlaceFrame, iface) +static inline DocHost *impl_from_IOleInPlaceFrame(IOleInPlaceFrame *iface) +{ + return (DocHost*)((char*)iface - FIELD_OFFSET(DocHost, IOleInPlaceFrame_iface)); +} static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv) { - DocHost *This = INPLACEFRAME_THIS(iface); - - *ppv = NULL; + DocHost *This = impl_from_IOleInPlaceFrame(iface); if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = INPLACEFRAME(This); + *ppv = &This->IOleInPlaceFrame_iface; }else if(IsEqualGUID(&IID_IOleWindow, riid)) { TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv); - *ppv = INPLACEFRAME(This); + *ppv = &This->IOleInPlaceFrame_iface; }else if(IsEqualGUID(&IID_IOleInPlaceUIWindow, riid)) { TRACE("(%p)->(IID_IOleInPlaceUIWindow %p)\n", This, ppv); - *ppv = INPLACEFRAME(This); + *ppv = &This->IOleInPlaceFrame_iface; }else if(IsEqualGUID(&IID_IOleInPlaceFrame, riid)) { TRACE("(%p)->(IID_IOleInPlaceFrame %p)\n", This, ppv); - *ppv = INPLACEFRAME(This); + *ppv = &This->IOleInPlaceFrame_iface; + }else { + *ppv = NULL; + WARN("Unsopported interface %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; } - if(*ppv) { - IOleInPlaceFrame_AddRef(INPLACEFRAME(This)); - return S_OK; - } - WARN("Unsopported interface %s\n", debugstr_guid(riid)); - return E_NOINTERFACE; + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; } static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); return IOleClientSite_AddRef(&This->IOleClientSite_iface); } static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); return IOleClientSite_Release(&This->IOleClientSite_iface); } static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); FIXME("(%p)->(%p)\n", This, phwnd); return E_NOTIMPL; } @@ -75,14 +76,14 @@ static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwn static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); FIXME("(%p)->(%x)\n", This, fEnterMode); return E_NOTIMPL; } static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); FIXME("(%p)->(%p)\n", This, lprectBorder); return E_NOTIMPL; } @@ -90,7 +91,7 @@ static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lpr static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface, LPCBORDERWIDTHS pborderwidths) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); FIXME("(%p)->(%p)\n", This, pborderwidths); return E_NOTIMPL; } @@ -98,7 +99,7 @@ static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface, static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface, LPCBORDERWIDTHS pborderwidths) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); FIXME("(%p)->(%p)\n", This, pborderwidths); return E_NOTIMPL; } @@ -106,7 +107,7 @@ static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface, static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface, IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); FIXME("(%p)->(%p %s)\n", This, pActiveObject, debugstr_w(pszObjName)); return E_NOTIMPL; } @@ -114,7 +115,7 @@ static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface, static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); FIXME("(%p)->(%p %p)\n", This, hmenuShared, lpMenuWidths); return E_NOTIMPL; } @@ -122,14 +123,14 @@ static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hm static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); FIXME("(%p)->(%p %p %p)\n", This, hmenuShared, holemenu, hwndActiveObject); return E_NOTIMPL; } static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); FIXME("(%p)->(%p)\n", This, hmenuShared); return E_NOTIMPL; } @@ -137,14 +138,14 @@ static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hm static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); TRACE("(%p)->(%s)\n", This, debugstr_w(pszStatusText)); return This->container_vtbl->SetStatusText(This, pszStatusText); } static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); FIXME("(%p)->(%x)\n", This, fEnable); return E_NOTIMPL; } @@ -152,12 +153,12 @@ static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID) { - DocHost *This = INPLACEFRAME_THIS(iface); + DocHost *This = impl_from_IOleInPlaceFrame(iface); FIXME("(%p)->(%p %d)\n", This, lpmsg, wID); return E_NOTIMPL; } -#undef INPLACEFRAME_THIS +#undef impl_from_IOleInPlaceFrame static const IOleInPlaceFrameVtbl OleInPlaceFrameVtbl = { InPlaceFrame_QueryInterface, @@ -179,5 +180,5 @@ static const IOleInPlaceFrameVtbl OleInPlaceFrameVtbl = { void DocHost_Frame_Init(DocHost *This) { - This->lpOleInPlaceFrameVtbl = &OleInPlaceFrameVtbl; + This->IOleInPlaceFrame_iface.lpVtbl = &OleInPlaceFrameVtbl; } diff --git a/dlls/shdocvw/ie.c b/dlls/shdocvw/ie.c index 9b3ff2bf095..32c2ccfb0b6 100644 --- a/dlls/shdocvw/ie.c +++ b/dlls/shdocvw/ie.c @@ -49,7 +49,7 @@ static HRESULT WINAPI InternetExplorer_QueryInterface(IWebBrowser2 *iface, REFII *ppv = &This->IWebBrowser2_iface; }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) { TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv); - *ppv = CONPTCONT(&This->doc_host.cps); + *ppv = &This->doc_host.cps.IConnectionPointContainer_iface; }else if(HlinkFrame_QI(&This->hlink_frame, riid, ppv)) { return S_OK; } diff --git a/dlls/shdocvw/iexplore.c b/dlls/shdocvw/iexplore.c index 77331821f1e..e5fcd52a523 100644 --- a/dlls/shdocvw/iexplore.c +++ b/dlls/shdocvw/iexplore.c @@ -722,6 +722,11 @@ static IWebBrowser2 *create_ie_window(LPCSTR cmdline) return wb; } +static inline InternetExplorer *impl_from_DocHost(DocHost *iface) +{ + return (InternetExplorer*)((char*)iface - FIELD_OFFSET(InternetExplorer, doc_host)); +} + static void WINAPI DocHostContainer_GetDocObjRect(DocHost* This, RECT* rc) { GetClientRect(This->frame_hwnd, rc); @@ -730,7 +735,7 @@ static void WINAPI DocHostContainer_GetDocObjRect(DocHost* This, RECT* rc) static HRESULT WINAPI DocHostContainer_SetStatusText(DocHost* This, LPCWSTR text) { - InternetExplorer* ie = DOCHOST_THIS(This); + InternetExplorer* ie = impl_from_DocHost(This); return update_ie_statustext(ie, text); } diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h index 5e9c8a384c7..bd6152d11e9 100644 --- a/dlls/shdocvw/shdocvw.h +++ b/dlls/shdocvw/shdocvw.h @@ -59,7 +59,7 @@ typedef struct ConnectionPoint ConnectionPoint; typedef struct DocHost DocHost; typedef struct { - const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl; + IConnectionPointContainer IConnectionPointContainer_iface; ConnectionPoint *wbe2; ConnectionPoint *wbe; @@ -103,7 +103,7 @@ struct DocHost { IServiceProvider IServiceProvider_iface; /* Interfaces of InPlaceFrame object */ - const IOleInPlaceFrameVtbl *lpOleInPlaceFrameVtbl; + IOleInPlaceFrame IOleInPlaceFrame_iface; IDispatch *disp; @@ -194,9 +194,6 @@ struct InternetExplorer { DocHost doc_host; }; -#define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl) -#define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpOleInPlaceFrameVtbl) - void WebBrowser_OleObject_Init(WebBrowser*); void WebBrowser_ViewObject_Init(WebBrowser*); void WebBrowser_Persist_Init(WebBrowser*); @@ -242,9 +239,6 @@ HRESULT InternetShortcut_Create(IUnknown*,REFIID,void**); HRESULT TaskbarList_Create(IUnknown*,REFIID,void**); -#define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc))) -#define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface) - /********************************************************************** * Dll lifetime tracking declaration for shdocvw.dll */ diff --git a/dlls/shdocvw/webbrowser.c b/dlls/shdocvw/webbrowser.c index 3b98b040102..cfc085f4321 100644 --- a/dlls/shdocvw/webbrowser.c +++ b/dlls/shdocvw/webbrowser.c @@ -86,7 +86,7 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid *ppv = &This->IProvideClassInfo2_iface; }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) { TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv); - *ppv = CONPTCONT(&This->doc_host.cps); + *ppv = &This->doc_host.cps.IConnectionPointContainer_iface; }else if(IsEqualGUID(&IID_IViewObject, riid)) { TRACE("(%p)->(IID_IViewObject %p)\n", This, ppv); *ppv = &This->IViewObject2_iface; @@ -1104,8 +1104,6 @@ static HRESULT STDMETHODCALLTYPE WBServiceProvider_QueryService(IServiceProvider return E_NOINTERFACE; } -#undef impl_from_IServiceProvider - static const IServiceProviderVtbl ServiceProviderVtbl = { WBServiceProvider_QueryInterface, @@ -1114,7 +1112,10 @@ static const IServiceProviderVtbl ServiceProviderVtbl = WBServiceProvider_QueryService }; -#define DOCHOST_THIS(iface) DEFINE_THIS2(WebBrowser,doc_host,iface) +static inline WebBrowser *impl_from_DocHost(DocHost *iface) +{ + return (WebBrowser*)((char*)iface - FIELD_OFFSET(WebBrowser, doc_host)); +} static void WINAPI DocHostContainer_GetDocObjRect(DocHost* This, RECT* rc) { @@ -1134,7 +1135,7 @@ static void WINAPI DocHostContainer_SetURL(DocHost* This, LPCWSTR url) static HRESULT DocHostContainer_exec(DocHost *doc_host, const GUID *cmd_group, DWORD cmdid, DWORD execopt, VARIANT *in, VARIANT *out) { - WebBrowser *This = DOCHOST_THIS(doc_host); + WebBrowser *This = impl_from_DocHost(doc_host); IOleCommandTarget *cmdtrg = NULL; HRESULT hres; @@ -1161,8 +1162,6 @@ static HRESULT DocHostContainer_exec(DocHost *doc_host, const GUID *cmd_group, D return hres; } -#undef DOCHOST_THIS - static const IDocHostContainerVtbl DocHostContainerVtbl = { DocHostContainer_GetDocObjRect, DocHostContainer_SetStatusText,