diff --git a/dlls/mshtml/service.c b/dlls/mshtml/service.c index ef5a9d18ffc..ab3d6d6d1bd 100644 --- a/dlls/mshtml/service.c +++ b/dlls/mshtml/service.c @@ -35,27 +35,28 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); typedef struct { - const IOleUndoManagerVtbl *lpOleUndoManagerVtbl; + IOleUndoManager IOleUndoManager_iface; LONG ref; } UndoManager; -#define UNDOMGR(x) ((IOleUndoManager*) &(x)->lpOleUndoManagerVtbl) - -#define UNDOMGR_THIS(iface) DEFINE_THIS(UndoManager, OleUndoManager, iface) +static inline UndoManager *impl_from_IOleUndoManager(IOleUndoManager *iface) +{ + return CONTAINING_RECORD(iface, UndoManager, IOleUndoManager_iface); +} static HRESULT WINAPI OleUndoManager_QueryInterface(IOleUndoManager *iface, REFIID riid, void **ppv) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); *ppv = NULL; if(IsEqualGUID(riid, &IID_IUnknown)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = UNDOMGR(This); + *ppv = &This->IOleUndoManager_iface; }else if(IsEqualGUID(riid, &IID_IOleUndoManager)) { TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv); - *ppv = UNDOMGR(This); + *ppv = &This->IOleUndoManager_iface; } @@ -65,7 +66,7 @@ static HRESULT WINAPI OleUndoManager_QueryInterface(IOleUndoManager *iface, REFI static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -75,7 +76,7 @@ static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface) static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -88,7 +89,7 @@ static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface) static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndoUnit *pPUU) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); FIXME("(%p)->(%p)\n", This, pPUU); return E_NOTIMPL; } @@ -96,42 +97,42 @@ static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndo static HRESULT WINAPI OleUndoManager_Close(IOleUndoManager *iface, IOleParentUndoUnit *pPUU, BOOL fCommit) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); FIXME("(%p)->(%p %x)\n", This, pPUU, fCommit); return E_NOTIMPL; } static HRESULT WINAPI OleUndoManager_Add(IOleUndoManager *iface, IOleUndoUnit *pUU) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); FIXME("(%p)->(%p)\n", This, pUU); return E_NOTIMPL; } static HRESULT WINAPI OleUndoManager_GetOpenParentState(IOleUndoManager *iface, DWORD *pdwState) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); FIXME("(%p)->(%p)\n", This, pdwState); return E_NOTIMPL; } static HRESULT WINAPI OleUndoManager_DiscardFrom(IOleUndoManager *iface, IOleUndoUnit *pUU) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); FIXME("(%p)->(%p)\n", This, pUU); return S_OK; } static HRESULT WINAPI OleUndoManager_UndoTo(IOleUndoManager *iface, IOleUndoUnit *pUU) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); FIXME("(%p)->(%p)\n", This, pUU); return E_NOTIMPL; } static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit *pUU) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); FIXME("(%p)->(%p)\n", This, pUU); return E_NOTIMPL; } @@ -139,7 +140,7 @@ static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface, IEnumOleUndoUnits **ppEnum) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); FIXME("(%p)->(%p)\n", This, ppEnum); return E_NOTIMPL; } @@ -147,34 +148,32 @@ static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface, static HRESULT WINAPI OleUndoManager_EnumRedoable(IOleUndoManager *iface, IEnumOleUndoUnits **ppEnum) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); FIXME("(%p)->(%p)\n", This, ppEnum); return E_NOTIMPL; } static HRESULT WINAPI OleUndoManager_GetLastUndoDescription(IOleUndoManager *iface, BSTR *pBstr) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); FIXME("(%p)->(%p)\n", This, pBstr); return E_NOTIMPL; } static HRESULT WINAPI OleUndoManager_GetLastRedoDescription(IOleUndoManager *iface, BSTR *pBstr) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); FIXME("(%p)->(%p)\n", This, pBstr); return E_NOTIMPL; } static HRESULT WINAPI OleUndoManager_Enable(IOleUndoManager *iface, BOOL fEnable) { - UndoManager *This = UNDOMGR_THIS(iface); + UndoManager *This = impl_from_IOleUndoManager(iface); FIXME("(%p)->(%x)\n", This, fEnable); return E_NOTIMPL; } -#undef UNDOMGR_THIS - static const IOleUndoManagerVtbl OleUndoManagerVtbl = { OleUndoManager_QueryInterface, OleUndoManager_AddRef, @@ -197,10 +196,10 @@ static IOleUndoManager *create_undomgr(void) { UndoManager *ret = heap_alloc(sizeof(UndoManager)); - ret->lpOleUndoManagerVtbl = &OleUndoManagerVtbl; + ret->IOleUndoManager_iface.lpVtbl = &OleUndoManagerVtbl; ret->ref = 1; - return UNDOMGR(ret); + return &ret->IOleUndoManager_iface; } /**********************************************************