From fc245339b0941074bdeae7dab038ec0bc31fa40f Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 17 Nov 2013 12:21:51 +0400 Subject: [PATCH] msctf: COM interface cleanup. --- dlls/msctf/compartmentmgr.c | 136 ++++++++------- dlls/msctf/context.c | 187 ++++++++++---------- dlls/msctf/displayattributemgr.c | 2 +- dlls/msctf/documentmgr.c | 10 +- dlls/msctf/inputprocessor.c | 148 ++++++++-------- dlls/msctf/langbarmgr.c | 2 +- dlls/msctf/range.c | 4 +- dlls/msctf/threadmgr.c | 281 ++++++++++++++++--------------- 8 files changed, 402 insertions(+), 368 deletions(-) diff --git a/dlls/msctf/compartmentmgr.c b/dlls/msctf/compartmentmgr.c index 35ebe2ab505..10a6428f5ee 100644 --- a/dlls/msctf/compartmentmgr.c +++ b/dlls/msctf/compartmentmgr.c @@ -51,7 +51,7 @@ typedef struct tagCompartmentValue { } CompartmentValue; typedef struct tagCompartmentMgr { - const ITfCompartmentMgrVtbl *CompartmentMgrVtbl; + ITfCompartmentMgr ITfCompartmentMgr_iface; LONG refCount; IUnknown *pUnkOuter; @@ -60,7 +60,7 @@ typedef struct tagCompartmentMgr { } CompartmentMgr; typedef struct tagCompartmentEnumGuid { - const IEnumGUIDVtbl *Vtbl; + IEnumGUID IEnumGUID_iface; LONG refCount; struct list *values; @@ -77,8 +77,8 @@ typedef struct tagCompartmentSink { } CompartmentSink; typedef struct tagCompartment { - const ITfCompartmentVtbl *Vtbl; - const ITfSourceVtbl *SourceVtbl; + ITfCompartment ITfCompartment_iface; + ITfSource ITfSource_iface; LONG refCount; /* Only VT_I4, VT_UNKNOWN and VT_BSTR data types are allowed */ @@ -90,14 +90,29 @@ typedef struct tagCompartment { static HRESULT CompartmentEnumGuid_Constructor(struct list* values, IEnumGUID **ppOut); static HRESULT Compartment_Constructor(CompartmentValue *value, ITfCompartment **ppOut); -static inline Compartment *impl_from_ITfSourceVtbl(ITfSource *iface) +static inline CompartmentMgr *impl_from_ITfCompartmentMgr(ITfCompartmentMgr *iface) { - return (Compartment *)((char *)iface - FIELD_OFFSET(Compartment,SourceVtbl)); + return CONTAINING_RECORD(iface, CompartmentMgr, ITfCompartmentMgr_iface); +} + +static inline Compartment *impl_from_ITfCompartment(ITfCompartment *iface) +{ + return CONTAINING_RECORD(iface, Compartment, ITfCompartment_iface); +} + +static inline Compartment *impl_from_ITfSource(ITfSource *iface) +{ + return CONTAINING_RECORD(iface, Compartment, ITfSource_iface); +} + +static inline CompartmentEnumGuid *impl_from_IEnumGUID(IEnumGUID *iface) +{ + return CONTAINING_RECORD(iface, CompartmentEnumGuid, IEnumGUID_iface); } HRESULT CompartmentMgr_Destructor(ITfCompartmentMgr *iface) { - CompartmentMgr *This = (CompartmentMgr *)iface; + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); struct list *cursor, *cursor2; LIST_FOR_EACH_SAFE(cursor, cursor2, &This->values) @@ -117,7 +132,7 @@ HRESULT CompartmentMgr_Destructor(ITfCompartmentMgr *iface) *****************************************************/ static HRESULT WINAPI CompartmentMgr_QueryInterface(ITfCompartmentMgr *iface, REFIID iid, LPVOID *ppvOut) { - CompartmentMgr *This = (CompartmentMgr *)iface; + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); if (This->pUnkOuter) return IUnknown_QueryInterface(This->pUnkOuter, iid, *ppvOut); else @@ -142,7 +157,7 @@ static HRESULT WINAPI CompartmentMgr_QueryInterface(ITfCompartmentMgr *iface, RE static ULONG WINAPI CompartmentMgr_AddRef(ITfCompartmentMgr *iface) { - CompartmentMgr *This = (CompartmentMgr *)iface; + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); if (This->pUnkOuter) return IUnknown_AddRef(This->pUnkOuter); else @@ -151,7 +166,7 @@ static ULONG WINAPI CompartmentMgr_AddRef(ITfCompartmentMgr *iface) static ULONG WINAPI CompartmentMgr_Release(ITfCompartmentMgr *iface) { - CompartmentMgr *This = (CompartmentMgr *)iface; + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); if (This->pUnkOuter) return IUnknown_Release(This->pUnkOuter); else @@ -168,7 +183,7 @@ static ULONG WINAPI CompartmentMgr_Release(ITfCompartmentMgr *iface) static HRESULT WINAPI CompartmentMgr_GetCompartment(ITfCompartmentMgr *iface, REFGUID rguid, ITfCompartment **ppcomp) { - CompartmentMgr *This = (CompartmentMgr *)iface; + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); CompartmentValue* value; struct list *cursor; HRESULT hr; @@ -207,8 +222,9 @@ static HRESULT WINAPI CompartmentMgr_GetCompartment(ITfCompartmentMgr *iface, static HRESULT WINAPI CompartmentMgr_ClearCompartment(ITfCompartmentMgr *iface, TfClientId tid, REFGUID rguid) { + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); struct list *cursor; - CompartmentMgr *This = (CompartmentMgr *)iface; + TRACE("(%p) %i %s\n",This,tid,debugstr_guid(rguid)); LIST_FOR_EACH(cursor, &This->values) @@ -231,19 +247,19 @@ static HRESULT WINAPI CompartmentMgr_ClearCompartment(ITfCompartmentMgr *iface, static HRESULT WINAPI CompartmentMgr_EnumCompartments(ITfCompartmentMgr *iface, IEnumGUID **ppEnum) { - CompartmentMgr *This = (CompartmentMgr *)iface; + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); + TRACE("(%p) %p\n",This,ppEnum); if (!ppEnum) return E_INVALIDARG; return CompartmentEnumGuid_Constructor(&This->values, ppEnum); } -static const ITfCompartmentMgrVtbl CompartmentMgr_CompartmentMgrVtbl = +static const ITfCompartmentMgrVtbl CompartmentMgrVtbl = { CompartmentMgr_QueryInterface, CompartmentMgr_AddRef, CompartmentMgr_Release, - CompartmentMgr_GetCompartment, CompartmentMgr_ClearCompartment, CompartmentMgr_EnumCompartments @@ -263,7 +279,7 @@ HRESULT CompartmentMgr_Constructor(IUnknown *pUnkOuter, REFIID riid, IUnknown ** if (This == NULL) return E_OUTOFMEMORY; - This->CompartmentMgrVtbl = &CompartmentMgr_CompartmentMgrVtbl; + This->ITfCompartmentMgr_iface.lpVtbl = &CompartmentMgrVtbl; This->pUnkOuter = pUnkOuter; list_init(&This->values); @@ -276,7 +292,7 @@ HRESULT CompartmentMgr_Constructor(IUnknown *pUnkOuter, REFIID riid, IUnknown ** else { HRESULT hr; - hr = IUnknown_QueryInterface((IUnknown*)This, riid, (LPVOID*)ppOut); + hr = ITfCompartmentMgr_QueryInterface(&This->ITfCompartmentMgr_iface, riid, (void**)ppOut); if (FAILED(hr)) HeapFree(GetProcessHeap(),0,This); return hr; @@ -294,12 +310,12 @@ static void CompartmentEnumGuid_Destructor(CompartmentEnumGuid *This) static HRESULT WINAPI CompartmentEnumGuid_QueryInterface(IEnumGUID *iface, REFIID iid, LPVOID *ppvOut) { - CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumGUID)) { - *ppvOut = This; + *ppvOut = &This->IEnumGUID_iface; } if (*ppvOut) @@ -314,13 +330,13 @@ static HRESULT WINAPI CompartmentEnumGuid_QueryInterface(IEnumGUID *iface, REFII static ULONG WINAPI CompartmentEnumGuid_AddRef(IEnumGUID *iface) { - CompartmentEnumGuid *This = (CompartmentEnumGuid*)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI CompartmentEnumGuid_Release(IEnumGUID *iface) { - CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -332,10 +348,10 @@ static ULONG WINAPI CompartmentEnumGuid_Release(IEnumGUID *iface) /***************************************************** * IEnumGuid functions *****************************************************/ -static HRESULT WINAPI CompartmentEnumGuid_Next( LPENUMGUID iface, +static HRESULT WINAPI CompartmentEnumGuid_Next(IEnumGUID *iface, ULONG celt, GUID *rgelt, ULONG *pceltFetched) { - CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); ULONG fetched = 0; TRACE("(%p)\n",This); @@ -359,27 +375,27 @@ static HRESULT WINAPI CompartmentEnumGuid_Next( LPENUMGUID iface, return fetched == celt ? S_OK : S_FALSE; } -static HRESULT WINAPI CompartmentEnumGuid_Skip( LPENUMGUID iface, ULONG celt) +static HRESULT WINAPI CompartmentEnumGuid_Skip(IEnumGUID *iface, ULONG celt) { - CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); TRACE("(%p)\n",This); This->cursor = list_next(This->values,This->cursor); return S_OK; } -static HRESULT WINAPI CompartmentEnumGuid_Reset( LPENUMGUID iface) +static HRESULT WINAPI CompartmentEnumGuid_Reset(IEnumGUID *iface) { - CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); TRACE("(%p)\n",This); This->cursor = list_head(This->values); return S_OK; } -static HRESULT WINAPI CompartmentEnumGuid_Clone( LPENUMGUID iface, +static HRESULT WINAPI CompartmentEnumGuid_Clone(IEnumGUID *iface, IEnumGUID **ppenum) { - CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); HRESULT res; TRACE("(%p)\n",This); @@ -389,17 +405,17 @@ static HRESULT WINAPI CompartmentEnumGuid_Clone( LPENUMGUID iface, res = CompartmentEnumGuid_Constructor(This->values, ppenum); if (SUCCEEDED(res)) { - CompartmentEnumGuid *new_This = (CompartmentEnumGuid *)*ppenum; + CompartmentEnumGuid *new_This = impl_from_IEnumGUID(*ppenum); new_This->cursor = This->cursor; } return res; } -static const IEnumGUIDVtbl IEnumGUID_Vtbl ={ +static const IEnumGUIDVtbl EnumGUIDVtbl = +{ CompartmentEnumGuid_QueryInterface, CompartmentEnumGuid_AddRef, CompartmentEnumGuid_Release, - CompartmentEnumGuid_Next, CompartmentEnumGuid_Skip, CompartmentEnumGuid_Reset, @@ -414,7 +430,7 @@ static HRESULT CompartmentEnumGuid_Constructor(struct list *values, IEnumGUID ** if (This == NULL) return E_OUTOFMEMORY; - This->Vtbl= &IEnumGUID_Vtbl; + This->IEnumGUID_iface.lpVtbl= &EnumGUIDVtbl; This->refCount = 1; This->values = values; @@ -450,16 +466,17 @@ static void Compartment_Destructor(Compartment *This) static HRESULT WINAPI Compartment_QueryInterface(ITfCompartment *iface, REFIID iid, LPVOID *ppvOut) { - Compartment *This = (Compartment *)iface; + Compartment *This = impl_from_ITfCompartment(iface); + *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfCompartment)) { - *ppvOut = This; + *ppvOut = &This->ITfCompartment_iface; } else if (IsEqualIID(iid, &IID_ITfSource)) { - *ppvOut = &This->SourceVtbl; + *ppvOut = &This->ITfSource_iface; } if (*ppvOut) @@ -474,13 +491,13 @@ static HRESULT WINAPI Compartment_QueryInterface(ITfCompartment *iface, REFIID i static ULONG WINAPI Compartment_AddRef(ITfCompartment *iface) { - Compartment *This = (Compartment*)iface; + Compartment *This = impl_from_ITfCompartment(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI Compartment_Release(ITfCompartment *iface) { - Compartment *This = (Compartment *)iface; + Compartment *This = impl_from_ITfCompartment(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -492,7 +509,7 @@ static ULONG WINAPI Compartment_Release(ITfCompartment *iface) static HRESULT WINAPI Compartment_SetValue(ITfCompartment *iface, TfClientId tid, const VARIANT *pvarValue) { - Compartment *This = (Compartment *)iface; + Compartment *This = impl_from_ITfCompartment(iface); struct list *cursor; TRACE("(%p) %i %p\n",This,tid,pvarValue); @@ -530,7 +547,7 @@ static HRESULT WINAPI Compartment_SetValue(ITfCompartment *iface, static HRESULT WINAPI Compartment_GetValue(ITfCompartment *iface, VARIANT *pvarValue) { - Compartment *This = (Compartment *)iface; + Compartment *This = impl_from_ITfCompartment(iface); TRACE("(%p) %p\n",This, pvarValue); if (!pvarValue) @@ -541,11 +558,11 @@ static HRESULT WINAPI Compartment_GetValue(ITfCompartment *iface, return VariantCopy(pvarValue,&This->variant); } -static const ITfCompartmentVtbl ITfCompartment_Vtbl ={ +static const ITfCompartmentVtbl CompartmentVtbl = +{ Compartment_QueryInterface, Compartment_AddRef, Compartment_Release, - Compartment_SetValue, Compartment_GetValue }; @@ -554,29 +571,29 @@ static const ITfCompartmentVtbl ITfCompartment_Vtbl ={ * ITfSource functions *****************************************************/ -static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) +static HRESULT WINAPI CompartmentSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) { - Compartment *This = impl_from_ITfSourceVtbl(iface); - return Compartment_QueryInterface((ITfCompartment *)This, iid, *ppvOut); + Compartment *This = impl_from_ITfSource(iface); + return ITfCompartment_QueryInterface(&This->ITfCompartment_iface, iid, *ppvOut); } -static ULONG WINAPI Source_AddRef(ITfSource *iface) +static ULONG WINAPI CompartmentSource_AddRef(ITfSource *iface) { - Compartment *This = impl_from_ITfSourceVtbl(iface); - return Compartment_AddRef((ITfCompartment*)This); + Compartment *This = impl_from_ITfSource(iface); + return ITfCompartment_AddRef(&This->ITfCompartment_iface); } -static ULONG WINAPI Source_Release(ITfSource *iface) +static ULONG WINAPI CompartmentSource_Release(ITfSource *iface) { - Compartment *This = impl_from_ITfSourceVtbl(iface); - return Compartment_Release((ITfCompartment *)This); + Compartment *This = impl_from_ITfSource(iface); + return ITfCompartment_Release(&This->ITfCompartment_iface); } static HRESULT WINAPI CompartmentSource_AdviseSink(ITfSource *iface, REFIID riid, IUnknown *punk, DWORD *pdwCookie) { + Compartment *This = impl_from_ITfSource(iface); CompartmentSink *cs; - Compartment *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); @@ -609,8 +626,8 @@ static HRESULT WINAPI CompartmentSource_AdviseSink(ITfSource *iface, static HRESULT WINAPI CompartmentSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) { + Compartment *This = impl_from_ITfSource(iface); CompartmentSink *sink; - Compartment *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %x\n",This,pdwCookie); @@ -627,12 +644,11 @@ static HRESULT WINAPI CompartmentSource_UnadviseSink(ITfSource *iface, DWORD pdw return S_OK; } -static const ITfSourceVtbl Compartment_SourceVtbl = +static const ITfSourceVtbl CompartmentSourceVtbl = { - Source_QueryInterface, - Source_AddRef, - Source_Release, - + CompartmentSource_QueryInterface, + CompartmentSource_AddRef, + CompartmentSource_Release, CompartmentSource_AdviseSink, CompartmentSource_UnadviseSink, }; @@ -645,8 +661,8 @@ static HRESULT Compartment_Constructor(CompartmentValue *valueData, ITfCompartme if (This == NULL) return E_OUTOFMEMORY; - This->Vtbl= &ITfCompartment_Vtbl; - This->SourceVtbl = &Compartment_SourceVtbl; + This->ITfCompartment_iface.lpVtbl= &CompartmentVtbl; + This->ITfSource_iface.lpVtbl = &CompartmentSourceVtbl; This->refCount = 1; This->valueData = valueData; diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c index 9d6cf86cdce..6f96e1ae26e 100644 --- a/dlls/msctf/context.c +++ b/dlls/msctf/context.c @@ -56,15 +56,15 @@ typedef struct tagContextSink { } ContextSink; typedef struct tagContext { - const ITfContextVtbl *ContextVtbl; - const ITfSourceVtbl *SourceVtbl; + ITfContext ITfContext_iface; + ITfSource ITfSource_iface; /* const ITfContextCompositionVtbl *ContextCompositionVtbl; */ /* const ITfContextOwnerCompositionServicesVtbl *ContextOwnerCompositionServicesVtbl; */ /* const ITfContextOwnerServicesVtbl *ContextOwnerServicesVtbl; */ - const ITfInsertAtSelectionVtbl *InsertAtSelectionVtbl; + ITfInsertAtSelection ITfInsertAtSelection_iface; /* const ITfMouseTrackerVtbl *MouseTrackerVtbl; */ /* const ITfQueryEmbeddedVtbl *QueryEmbeddedVtbl; */ - const ITfSourceSingleVtbl *SourceSingleVtbl; + ITfSourceSingle ITfSourceSingle_iface; LONG refCount; BOOL connected; @@ -97,7 +97,7 @@ typedef struct tagEditCookie { } EditCookie; typedef struct tagTextStoreACPSink { - const ITextStoreACPSinkVtbl *TextStoreACPSinkVtbl; + ITextStoreACPSink ITextStoreACPSink_iface; /* const ITextStoreACPServicesVtbl *TextStoreACPServicesVtbl; */ LONG refCount; @@ -107,19 +107,29 @@ typedef struct tagTextStoreACPSink { static HRESULT TextStoreACPSink_Constructor(ITextStoreACPSink **ppOut, Context *pContext); -static inline Context *impl_from_ITfSourceVtbl(ITfSource *iface) +static inline Context *impl_from_ITfContext(ITfContext *iface) { - return (Context *)((char *)iface - FIELD_OFFSET(Context,SourceVtbl)); + return CONTAINING_RECORD(iface, Context, ITfContext_iface); } -static inline Context *impl_from_ITfInsertAtSelectionVtbl(ITfInsertAtSelection*iface) +static inline Context *impl_from_ITfSource(ITfSource *iface) { - return (Context *)((char *)iface - FIELD_OFFSET(Context,InsertAtSelectionVtbl)); + return CONTAINING_RECORD(iface, Context, ITfSource_iface); } -static inline Context *impl_from_ITfSourceSingleVtbl(ITfSourceSingle* iface) +static inline Context *impl_from_ITfInsertAtSelection(ITfInsertAtSelection *iface) { - return (Context *)((char *)iface - FIELD_OFFSET(Context,SourceSingleVtbl)); + return CONTAINING_RECORD(iface, Context, ITfInsertAtSelection_iface); +} + +static inline Context *impl_from_ITfSourceSingle(ITfSourceSingle* iface) +{ + return CONTAINING_RECORD(iface, Context, ITfSourceSingle_iface); +} + +static inline TextStoreACPSink *impl_from_ITextStoreACPSink(ITextStoreACPSink *iface) +{ + return CONTAINING_RECORD(iface, TextStoreACPSink, ITextStoreACPSink_iface); } static void free_sink(ContextSink *sink) @@ -190,20 +200,20 @@ static void Context_Destructor(Context *This) static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVOID *ppvOut) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfContext)) { - *ppvOut = This; + *ppvOut = &This->ITfContext_iface; } else if (IsEqualIID(iid, &IID_ITfSource)) { - *ppvOut = &This->SourceVtbl; + *ppvOut = &This->ITfSource_iface; } else if (IsEqualIID(iid, &IID_ITfInsertAtSelection)) { - *ppvOut = &This->InsertAtSelectionVtbl; + *ppvOut = &This->ITfInsertAtSelection_iface; } else if (IsEqualIID(iid, &IID_ITfCompartmentMgr)) { @@ -211,7 +221,7 @@ static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVO } else if (IsEqualIID(iid, &IID_ITfSourceSingle)) { - *ppvOut = &This->SourceSingleVtbl; + *ppvOut = &This->ITfSourceSingle_iface; } if (*ppvOut) @@ -226,13 +236,13 @@ static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVO static ULONG WINAPI Context_AddRef(ITfContext *iface) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI Context_Release(ITfContext *iface) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -248,8 +258,8 @@ static HRESULT WINAPI Context_RequestEditSession (ITfContext *iface, TfClientId tid, ITfEditSession *pes, DWORD dwFlags, HRESULT *phrSession) { + Context *This = impl_from_ITfContext(iface); HRESULT hr; - Context *This = (Context *)iface; DWORD dwLockFlags = 0x0; TRACE("(%p) %i %p %x %p\n",This, tid, pes, dwFlags, phrSession); @@ -299,7 +309,7 @@ static HRESULT WINAPI Context_InWriteSession (ITfContext *iface, TfClientId tid, BOOL *pfWriteSession) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -308,7 +318,7 @@ static HRESULT WINAPI Context_GetSelection (ITfContext *iface, TfEditCookie ec, ULONG ulIndex, ULONG ulCount, TF_SELECTION *pSelection, ULONG *pcFetched) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); EditCookie *cookie; ULONG count, i; ULONG totalFetched = 0; @@ -367,8 +377,8 @@ static HRESULT WINAPI Context_GetSelection (ITfContext *iface, static HRESULT WINAPI Context_SetSelection (ITfContext *iface, TfEditCookie ec, ULONG ulCount, const TF_SELECTION *pSelection) { + Context *This = impl_from_ITfContext(iface); TS_SELECTION_ACP *acp; - Context *This = (Context *)iface; ULONG i; HRESULT hr; @@ -405,7 +415,7 @@ static HRESULT WINAPI Context_SetSelection (ITfContext *iface, static HRESULT WINAPI Context_GetStart (ITfContext *iface, TfEditCookie ec, ITfRange **ppStart) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); EditCookie *cookie; TRACE("(%p) %i %p\n",This,ec,ppStart); @@ -427,7 +437,7 @@ static HRESULT WINAPI Context_GetStart (ITfContext *iface, static HRESULT WINAPI Context_GetEnd (ITfContext *iface, TfEditCookie ec, ITfRange **ppEnd) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); EditCookie *cookie; LONG end; TRACE("(%p) %i %p\n",This,ec,ppEnd); @@ -458,7 +468,7 @@ static HRESULT WINAPI Context_GetEnd (ITfContext *iface, static HRESULT WINAPI Context_GetActiveView (ITfContext *iface, ITfContextView **ppView) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -466,7 +476,7 @@ static HRESULT WINAPI Context_GetActiveView (ITfContext *iface, static HRESULT WINAPI Context_EnumViews (ITfContext *iface, IEnumTfContextViews **ppEnum) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -474,7 +484,7 @@ static HRESULT WINAPI Context_EnumViews (ITfContext *iface, static HRESULT WINAPI Context_GetStatus (ITfContext *iface, TF_STATUS *pdcs) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); TRACE("(%p) %p\n",This,pdcs); if (!This->connected) @@ -499,7 +509,7 @@ static HRESULT WINAPI Context_GetStatus (ITfContext *iface, static HRESULT WINAPI Context_GetProperty (ITfContext *iface, REFGUID guidProp, ITfProperty **ppProp) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -507,7 +517,7 @@ static HRESULT WINAPI Context_GetProperty (ITfContext *iface, static HRESULT WINAPI Context_GetAppProperty (ITfContext *iface, REFGUID guidProp, ITfReadOnlyProperty **ppProp) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -516,7 +526,7 @@ static HRESULT WINAPI Context_TrackProperties (ITfContext *iface, const GUID **prgProp, ULONG cProp, const GUID **prgAppProp, ULONG cAppProp, ITfReadOnlyProperty **ppProperty) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -524,7 +534,7 @@ static HRESULT WINAPI Context_TrackProperties (ITfContext *iface, static HRESULT WINAPI Context_EnumProperties (ITfContext *iface, IEnumTfProperties **ppEnum) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -532,7 +542,7 @@ static HRESULT WINAPI Context_EnumProperties (ITfContext *iface, static HRESULT WINAPI Context_GetDocumentMgr (ITfContext *iface, ITfDocumentMgr **ppDm) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); TRACE("(%p) %p\n",This,ppDm); if (!ppDm) @@ -550,17 +560,16 @@ static HRESULT WINAPI Context_GetDocumentMgr (ITfContext *iface, static HRESULT WINAPI Context_CreateRangeBackup (ITfContext *iface, TfEditCookie ec, ITfRange *pRange, ITfRangeBackup **ppBackup) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } -static const ITfContextVtbl Context_ContextVtbl = +static const ITfContextVtbl ContextVtbl = { Context_QueryInterface, Context_AddRef, Context_Release, - Context_RequestEditSession, Context_InWriteSession, Context_GetSelection, @@ -578,22 +587,22 @@ static const ITfContextVtbl Context_ContextVtbl = Context_CreateRangeBackup }; -static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) +static HRESULT WINAPI ContextSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) { - Context *This = impl_from_ITfSourceVtbl(iface); - return Context_QueryInterface((ITfContext *)This, iid, *ppvOut); + Context *This = impl_from_ITfSource(iface); + return ITfContext_QueryInterface(&This->ITfContext_iface, iid, *ppvOut); } -static ULONG WINAPI Source_AddRef(ITfSource *iface) +static ULONG WINAPI ContextSource_AddRef(ITfSource *iface) { - Context *This = impl_from_ITfSourceVtbl(iface); - return Context_AddRef((ITfContext *)This); + Context *This = impl_from_ITfSource(iface); + return ITfContext_AddRef(&This->ITfContext_iface); } -static ULONG WINAPI Source_Release(ITfSource *iface) +static ULONG WINAPI ContextSource_Release(ITfSource *iface) { - Context *This = impl_from_ITfSourceVtbl(iface); - return Context_Release((ITfContext *)This); + Context *This = impl_from_ITfSource(iface); + return ITfContext_Release(&This->ITfContext_iface); } /***************************************************** @@ -602,8 +611,8 @@ static ULONG WINAPI Source_Release(ITfSource *iface) static HRESULT WINAPI ContextSource_AdviseSink(ITfSource *iface, REFIID riid, IUnknown *punk, DWORD *pdwCookie) { + Context *This = impl_from_ITfSource(iface); ContextSink *es; - Context *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); if (!riid || !punk || !pdwCookie) @@ -634,8 +643,8 @@ static HRESULT WINAPI ContextSource_AdviseSink(ITfSource *iface, static HRESULT WINAPI ContextSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) { + Context *This = impl_from_ITfSource(iface); ContextSink *sink; - Context *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %x\n",This,pdwCookie); @@ -652,14 +661,13 @@ static HRESULT WINAPI ContextSource_UnadviseSink(ITfSource *iface, DWORD pdwCook return S_OK; } -static const ITfSourceVtbl Context_SourceVtbl = +static const ITfSourceVtbl ContextSourceVtbl = { - Source_QueryInterface, - Source_AddRef, - Source_Release, - + ContextSource_QueryInterface, + ContextSource_AddRef, + ContextSource_Release, ContextSource_AdviseSink, - ContextSource_UnadviseSink, + ContextSource_UnadviseSink }; /***************************************************** @@ -667,27 +675,27 @@ static const ITfSourceVtbl Context_SourceVtbl = *****************************************************/ static HRESULT WINAPI InsertAtSelection_QueryInterface(ITfInsertAtSelection *iface, REFIID iid, LPVOID *ppvOut) { - Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); - return Context_QueryInterface((ITfContext *)This, iid, *ppvOut); + Context *This = impl_from_ITfInsertAtSelection(iface); + return ITfContext_QueryInterface(&This->ITfContext_iface, iid, *ppvOut); } static ULONG WINAPI InsertAtSelection_AddRef(ITfInsertAtSelection *iface) { - Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); - return Context_AddRef((ITfContext *)This); + Context *This = impl_from_ITfInsertAtSelection(iface); + return ITfContext_AddRef(&This->ITfContext_iface); } static ULONG WINAPI InsertAtSelection_Release(ITfInsertAtSelection *iface) { - Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); - return Context_Release((ITfContext *)This); + Context *This = impl_from_ITfInsertAtSelection(iface); + return ITfContext_Release(&This->ITfContext_iface); } static HRESULT WINAPI InsertAtSelection_InsertTextAtSelection( ITfInsertAtSelection *iface, TfEditCookie ec, DWORD dwFlags, const WCHAR *pchText, LONG cch, ITfRange **ppRange) { - Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); + Context *This = impl_from_ITfInsertAtSelection(iface); EditCookie *cookie; LONG acpStart, acpEnd; TS_TEXTCHANGE change; @@ -723,17 +731,16 @@ static HRESULT WINAPI InsertAtSelection_InsertEmbeddedAtSelection( ITfInsertAtSelection *iface, TfEditCookie ec, DWORD dwFlags, IDataObject *pDataObject, ITfRange **ppRange) { - Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); + Context *This = impl_from_ITfInsertAtSelection(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } -static const ITfInsertAtSelectionVtbl Context_InsertAtSelectionVtbl = +static const ITfInsertAtSelectionVtbl InsertAtSelectionVtbl = { InsertAtSelection_QueryInterface, InsertAtSelection_AddRef, InsertAtSelection_Release, - InsertAtSelection_InsertTextAtSelection, InsertAtSelection_InsertEmbeddedAtSelection, }; @@ -743,26 +750,26 @@ static const ITfInsertAtSelectionVtbl Context_InsertAtSelectionVtbl = *****************************************************/ static HRESULT WINAPI SourceSingle_QueryInterface(ITfSourceSingle *iface, REFIID iid, LPVOID *ppvOut) { - Context *This = impl_from_ITfSourceSingleVtbl(iface); + Context *This = impl_from_ITfSourceSingle(iface); return Context_QueryInterface((ITfContext *)This, iid, *ppvOut); } static ULONG WINAPI SourceSingle_AddRef(ITfSourceSingle *iface) { - Context *This = impl_from_ITfSourceSingleVtbl(iface); + Context *This = impl_from_ITfSourceSingle(iface); return Context_AddRef((ITfContext *)This); } static ULONG WINAPI SourceSingle_Release(ITfSourceSingle *iface) { - Context *This = impl_from_ITfSourceSingleVtbl(iface); + Context *This = impl_from_ITfSourceSingle(iface); return Context_Release((ITfContext *)This); } static HRESULT WINAPI SourceSingle_AdviseSingleSink( ITfSourceSingle *iface, TfClientId tid, REFIID riid, IUnknown *punk) { - Context *This = impl_from_ITfSourceSingleVtbl(iface); + Context *This = impl_from_ITfSourceSingle(iface); FIXME("STUB:(%p) %i %s %p\n",This, tid, debugstr_guid(riid),punk); return E_NOTIMPL; } @@ -770,17 +777,16 @@ static HRESULT WINAPI SourceSingle_AdviseSingleSink( ITfSourceSingle *iface, static HRESULT WINAPI SourceSingle_UnadviseSingleSink( ITfSourceSingle *iface, TfClientId tid, REFIID riid) { - Context *This = impl_from_ITfSourceSingleVtbl(iface); + Context *This = impl_from_ITfSourceSingle(iface); FIXME("STUB:(%p) %i %s\n",This, tid, debugstr_guid(riid)); return E_NOTIMPL; } -static const ITfSourceSingleVtbl Context_SourceSingleVtbl = +static const ITfSourceSingleVtbl ContextSourceSingleVtbl = { SourceSingle_QueryInterface, SourceSingle_AddRef, SourceSingle_Release, - SourceSingle_AdviseSingleSink, SourceSingle_UnadviseSingleSink, }; @@ -803,16 +809,16 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfDocumentMgr TRACE("(%p) %x %p %p %p\n",This, tidOwner, punk, ppOut, pecTextStore); - This->ContextVtbl= &Context_ContextVtbl; - This->SourceVtbl = &Context_SourceVtbl; - This->InsertAtSelectionVtbl = &Context_InsertAtSelectionVtbl; - This->SourceSingleVtbl = &Context_SourceSingleVtbl; + This->ITfContext_iface.lpVtbl= &ContextVtbl; + This->ITfSource_iface.lpVtbl = &ContextSourceVtbl; + This->ITfInsertAtSelection_iface.lpVtbl = &InsertAtSelectionVtbl; + This->ITfSourceSingle_iface.lpVtbl = &ContextSourceSingleVtbl; This->refCount = 1; This->tidOwner = tidOwner; This->connected = FALSE; This->manager = mgr; - CompartmentMgr_Constructor((IUnknown*)This, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr); + CompartmentMgr_Constructor((IUnknown*)&This->ITfContext_iface, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr); cookie->lockType = TF_ES_READ; cookie->pOwningContext = This; @@ -846,7 +852,7 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfDocumentMgr HRESULT Context_Initialize(ITfContext *iface, ITfDocumentMgr *manager) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); if (This->pITextStoreACP) { @@ -861,7 +867,7 @@ HRESULT Context_Initialize(ITfContext *iface, ITfDocumentMgr *manager) HRESULT Context_Uninitialize(ITfContext *iface) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); if (This->pITextStoreACPSink) { @@ -886,7 +892,7 @@ static void TextStoreACPSink_Destructor(TextStoreACPSink *This) static HRESULT WINAPI TextStoreACPSink_QueryInterface(ITextStoreACPSink *iface, REFIID iid, LPVOID *ppvOut) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITextStoreACPSink)) @@ -906,13 +912,13 @@ static HRESULT WINAPI TextStoreACPSink_QueryInterface(ITextStoreACPSink *iface, static ULONG WINAPI TextStoreACPSink_AddRef(ITextStoreACPSink *iface) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI TextStoreACPSink_Release(ITextStoreACPSink *iface) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -928,14 +934,14 @@ static ULONG WINAPI TextStoreACPSink_Release(ITextStoreACPSink *iface) static HRESULT WINAPI TextStoreACPSink_OnTextChange(ITextStoreACPSink *iface, DWORD dwFlags, const TS_TEXTCHANGE *pChange) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } static HRESULT WINAPI TextStoreACPSink_OnSelectionChange(ITextStoreACPSink *iface) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -943,7 +949,7 @@ static HRESULT WINAPI TextStoreACPSink_OnSelectionChange(ITextStoreACPSink *ifac static HRESULT WINAPI TextStoreACPSink_OnLayoutChange(ITextStoreACPSink *iface, TsLayoutCode lcode, TsViewCookie vcView) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -951,7 +957,7 @@ static HRESULT WINAPI TextStoreACPSink_OnLayoutChange(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnStatusChange(ITextStoreACPSink *iface, DWORD dwFlags) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); HRESULT hr, hrSession; TRACE("(%p) %x\n",This, dwFlags); @@ -979,7 +985,7 @@ static HRESULT WINAPI TextStoreACPSink_OnStatusChange(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnAttrsChange(ITextStoreACPSink *iface, LONG acpStart, LONG acpEnd, ULONG cAttrs, const TS_ATTRID *paAttrs) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -987,7 +993,7 @@ static HRESULT WINAPI TextStoreACPSink_OnAttrsChange(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface, DWORD dwLockFlags) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); HRESULT hr; EditCookie *cookie,*sinkcookie; TfEditCookie ec; @@ -1055,24 +1061,23 @@ static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnStartEditTransaction(ITextStoreACPSink *iface) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } static HRESULT WINAPI TextStoreACPSink_OnEndEditTransaction(ITextStoreACPSink *iface) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } -static const ITextStoreACPSinkVtbl TextStoreACPSink_TextStoreACPSinkVtbl = +static const ITextStoreACPSinkVtbl TextStoreACPSinkVtbl = { TextStoreACPSink_QueryInterface, TextStoreACPSink_AddRef, TextStoreACPSink_Release, - TextStoreACPSink_OnTextChange, TextStoreACPSink_OnSelectionChange, TextStoreACPSink_OnLayoutChange, @@ -1091,12 +1096,12 @@ static HRESULT TextStoreACPSink_Constructor(ITextStoreACPSink **ppOut, Context * if (This == NULL) return E_OUTOFMEMORY; - This->TextStoreACPSinkVtbl= &TextStoreACPSink_TextStoreACPSinkVtbl; + This->ITextStoreACPSink_iface.lpVtbl= &TextStoreACPSinkVtbl; This->refCount = 1; This->pContext = pContext; TRACE("returning %p\n", This); - *ppOut = (ITextStoreACPSink*)This; + *ppOut = &This->ITextStoreACPSink_iface; return S_OK; } diff --git a/dlls/msctf/displayattributemgr.c b/dlls/msctf/displayattributemgr.c index 0893a8f0d27..8f7869ba951 100644 --- a/dlls/msctf/displayattributemgr.c +++ b/dlls/msctf/displayattributemgr.c @@ -56,7 +56,7 @@ static HRESULT WINAPI DisplayAttributeMgr_QueryInterface(ITfDisplayAttributeMgr if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfDisplayAttributeMgr)) { - *ppvOut = This; + *ppvOut = &This->ITfDisplayAttributeMgr_iface; } if (*ppvOut) diff --git a/dlls/msctf/documentmgr.c b/dlls/msctf/documentmgr.c index c9aebb2823c..f3cc12b5ce1 100644 --- a/dlls/msctf/documentmgr.c +++ b/dlls/msctf/documentmgr.c @@ -100,7 +100,7 @@ static HRESULT WINAPI DocumentMgr_QueryInterface(ITfDocumentMgr *iface, REFIID i if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfDocumentMgr)) { - *ppvOut = This; + *ppvOut = &This->ITfDocumentMgr_iface; } else if (IsEqualIID(iid, &IID_ITfSource)) { @@ -280,19 +280,19 @@ static const ITfDocumentMgrVtbl DocumentMgr_DocumentMgrVtbl = static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) { DocumentMgr *This = impl_from_ITfSource(iface); - return DocumentMgr_QueryInterface(&This->ITfDocumentMgr_iface, iid, *ppvOut); + return ITfDocumentMgr_QueryInterface(&This->ITfDocumentMgr_iface, iid, *ppvOut); } static ULONG WINAPI Source_AddRef(ITfSource *iface) { DocumentMgr *This = impl_from_ITfSource(iface); - return DocumentMgr_AddRef(&This->ITfDocumentMgr_iface); + return ITfDocumentMgr_AddRef(&This->ITfDocumentMgr_iface); } static ULONG WINAPI Source_Release(ITfSource *iface) { DocumentMgr *This = impl_from_ITfSource(iface); - return DocumentMgr_Release(&This->ITfDocumentMgr_iface); + return ITfDocumentMgr_Release(&This->ITfDocumentMgr_iface); } /***************************************************** @@ -359,7 +359,7 @@ static HRESULT WINAPI EnumTfContext_QueryInterface(IEnumTfContexts *iface, REFII if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfContexts)) { - *ppvOut = This; + *ppvOut = &This->IEnumTfContexts_iface; } if (*ppvOut) diff --git a/dlls/msctf/inputprocessor.c b/dlls/msctf/inputprocessor.c index 9c68007ea7f..5ef8fe0977a 100644 --- a/dlls/msctf/inputprocessor.c +++ b/dlls/msctf/inputprocessor.c @@ -62,8 +62,8 @@ typedef struct tagInputProcessorProfilesSink { } InputProcessorProfilesSink; typedef struct tagInputProcessorProfiles { - const ITfInputProcessorProfilesVtbl *InputProcessorProfilesVtbl; - const ITfSourceVtbl *SourceVtbl; + ITfInputProcessorProfiles ITfInputProcessorProfiles_iface; + ITfSource ITfSource_iface; /* const ITfInputProcessorProfileMgrVtbl *InputProcessorProfileMgrVtbl; */ /* const ITfInputProcessorProfilesExVtbl *InputProcessorProfilesExVtbl; */ /* const ITfInputProcessorProfileSubstituteLayoutVtbl *InputProcessorProfileSubstituteLayoutVtbl; */ @@ -75,7 +75,7 @@ typedef struct tagInputProcessorProfiles { } InputProcessorProfiles; typedef struct tagProfilesEnumGuid { - const IEnumGUIDVtbl *Vtbl; + IEnumGUID IEnumGUID_iface; LONG refCount; HKEY key; @@ -83,7 +83,7 @@ typedef struct tagProfilesEnumGuid { } ProfilesEnumGuid; typedef struct tagEnumTfLanguageProfiles { - const IEnumTfLanguageProfilesVtbl *Vtbl; + IEnumTfLanguageProfiles IEnumTfLanguageProfiles_iface; LONG refCount; HKEY tipkey; @@ -100,9 +100,24 @@ typedef struct tagEnumTfLanguageProfiles { static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut); static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **ppOut); -static inline InputProcessorProfiles *impl_from_ITfSourceVtbl(ITfSource *iface) +static inline InputProcessorProfiles *impl_from_ITfInputProcessorProfiles(ITfInputProcessorProfiles *iface) { - return (InputProcessorProfiles *)((char *)iface - FIELD_OFFSET(InputProcessorProfiles,SourceVtbl)); + return CONTAINING_RECORD(iface, InputProcessorProfiles, ITfInputProcessorProfiles_iface); +} + +static inline InputProcessorProfiles *impl_from_ITfSource(ITfSource *iface) +{ + return CONTAINING_RECORD(iface, InputProcessorProfiles, ITfSource_iface); +} + +static inline ProfilesEnumGuid *impl_from_IEnumGUID(IEnumGUID *iface) +{ + return CONTAINING_RECORD(iface, ProfilesEnumGuid, IEnumGUID_iface); +} + +static inline EnumTfLanguageProfiles *impl_from_IEnumTfLanguageProfiles(IEnumTfLanguageProfiles *iface) +{ + return CONTAINING_RECORD(iface, EnumTfLanguageProfiles, IEnumTfLanguageProfiles_iface); } static void free_sink(InputProcessorProfilesSink *sink) @@ -158,16 +173,16 @@ static void add_userkey( REFCLSID rclsid, LANGID langid, static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorProfiles *iface, REFIID iid, LPVOID *ppvOut) { - InputProcessorProfiles *This = (InputProcessorProfiles *)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfInputProcessorProfiles)) { - *ppvOut = This; + *ppvOut = &This->ITfInputProcessorProfiles_iface; } else if (IsEqualIID(iid, &IID_ITfSource)) { - *ppvOut = &This->SourceVtbl; + *ppvOut = &This->ITfSource_iface; } if (*ppvOut) @@ -182,13 +197,13 @@ static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorPro static ULONG WINAPI InputProcessorProfiles_AddRef(ITfInputProcessorProfiles *iface) { - InputProcessorProfiles *This = (InputProcessorProfiles *)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI InputProcessorProfiles_Release(ITfInputProcessorProfiles *iface) { - InputProcessorProfiles *This = (InputProcessorProfiles *)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -203,7 +218,7 @@ static ULONG WINAPI InputProcessorProfiles_Release(ITfInputProcessorProfiles *if static HRESULT WINAPI InputProcessorProfiles_Register( ITfInputProcessorProfiles *iface, REFCLSID rclsid) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); HKEY tipkey; WCHAR buf[39]; WCHAR fullkey[68]; @@ -225,9 +240,9 @@ static HRESULT WINAPI InputProcessorProfiles_Register( static HRESULT WINAPI InputProcessorProfiles_Unregister( ITfInputProcessorProfiles *iface, REFCLSID rclsid) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); WCHAR buf[39]; WCHAR fullkey[68]; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("(%p) %s\n",This,debugstr_guid(rclsid)); @@ -246,6 +261,7 @@ static HRESULT WINAPI InputProcessorProfiles_AddLanguageProfile( ULONG cchDesc, const WCHAR *pchIconFile, ULONG cchFile, ULONG uIconIndex) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); HKEY tipkey,fmtkey; WCHAR buf[39]; WCHAR fullkey[100]; @@ -257,8 +273,6 @@ static HRESULT WINAPI InputProcessorProfiles_AddLanguageProfile( static const WCHAR icnf[] = {'I','c','o','n','F','i','l','e',0}; static const WCHAR icni[] = {'I','c','o','n','I','n','d','e','x',0}; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; - TRACE("(%p) %s %x %s %s %s %i\n",This,debugstr_guid(rclsid), langid, debugstr_guid(guidProfile), debugstr_wn(pchDesc,cchDesc), debugstr_wn(pchIconFile,cchFile),uIconIndex); @@ -300,7 +314,7 @@ static HRESULT WINAPI InputProcessorProfiles_RemoveLanguageProfile( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfile) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -308,7 +322,7 @@ static HRESULT WINAPI InputProcessorProfiles_RemoveLanguageProfile( static HRESULT WINAPI InputProcessorProfiles_EnumInputProcessorInfo( ITfInputProcessorProfiles *iface, IEnumGUID **ppEnum) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); TRACE("(%p) %p\n",This,ppEnum); return ProfilesEnumGuid_Constructor(ppEnum); } @@ -317,12 +331,12 @@ static HRESULT WINAPI InputProcessorProfiles_GetDefaultLanguageProfile( ITfInputProcessorProfiles *iface, LANGID langid, REFGUID catid, CLSID *pclsid, GUID *pguidProfile) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); WCHAR fullkey[168]; WCHAR buf[39]; HKEY hkey; DWORD count; ULONG res; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("%p) %x %s %p %p\n",This, langid, debugstr_guid(catid),pclsid,pguidProfile); @@ -358,13 +372,13 @@ static HRESULT WINAPI InputProcessorProfiles_SetDefaultLanguageProfile( ITfInputProcessorProfiles *iface, LANGID langid, REFCLSID rclsid, REFGUID guidProfiles) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); WCHAR fullkey[168]; WCHAR buf[39]; HKEY hkey; GUID catid; HRESULT hr; ITfCategoryMgr *catmgr; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; static const GUID * tipcats[3] = { &GUID_TFCAT_TIP_KEYBOARD, &GUID_TFCAT_TIP_SPEECH, &GUID_TFCAT_TIP_HANDWRITING }; @@ -408,10 +422,10 @@ static HRESULT WINAPI InputProcessorProfiles_ActivateLanguageProfile( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfiles) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); HRESULT hr; BOOL enabled; TF_LANGUAGEPROFILE LanguageProfile; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("(%p) %s %x %s\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfiles)); @@ -444,8 +458,8 @@ static HRESULT WINAPI InputProcessorProfiles_GetActiveLanguageProfile( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID *plangid, GUID *pguidProfile) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); TF_LANGUAGEPROFILE profile; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("(%p) %s %p %p\n",This,debugstr_guid(rclsid),plangid,pguidProfile); @@ -469,7 +483,7 @@ static HRESULT WINAPI InputProcessorProfiles_GetLanguageProfileDescription( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfile, BSTR *pbstrProfile) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -477,7 +491,7 @@ static HRESULT WINAPI InputProcessorProfiles_GetLanguageProfileDescription( static HRESULT WINAPI InputProcessorProfiles_GetCurrentLanguage( ITfInputProcessorProfiles *iface, LANGID *plangid) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); TRACE("(%p) 0x%x\n",This,This->currentLanguage); if (!plangid) @@ -491,8 +505,8 @@ static HRESULT WINAPI InputProcessorProfiles_GetCurrentLanguage( static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage( ITfInputProcessorProfiles *iface, LANGID langid) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); struct list *cursor; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; BOOL accept; FIXME("STUB:(%p)\n",This); @@ -513,7 +527,7 @@ static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage( static HRESULT WINAPI InputProcessorProfiles_GetLanguageList( ITfInputProcessorProfiles *iface, LANGID **ppLangId, ULONG *pulCount) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); FIXME("Semi-STUB:(%p)\n",This); *ppLangId = CoTaskMemAlloc(sizeof(LANGID)); **ppLangId = This->currentLanguage; @@ -525,7 +539,7 @@ static HRESULT WINAPI InputProcessorProfiles_EnumLanguageProfiles( ITfInputProcessorProfiles *iface, LANGID langid, IEnumTfLanguageProfiles **ppEnum) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); TRACE("(%p) %x %p\n",This,langid,ppEnum); return EnumTfLanguageProfiles_Constructor(langid, ppEnum); } @@ -534,13 +548,13 @@ static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfile( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfile, BOOL fEnable) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); HKEY key; WCHAR buf[39]; WCHAR buf2[39]; WCHAR fullkey[168]; ULONG res; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("(%p) %s %x %s %i\n",This, debugstr_guid(rclsid), langid, debugstr_guid(guidProfile), fEnable); StringFromGUID2(rclsid, buf, 39); @@ -564,13 +578,13 @@ static HRESULT WINAPI InputProcessorProfiles_IsEnabledLanguageProfile( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfile, BOOL *pfEnable) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); HKEY key; WCHAR buf[39]; WCHAR buf2[39]; WCHAR fullkey[168]; ULONG res; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("(%p) %s, %i, %s, %p\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfile),pfEnable); if (!pfEnable) @@ -611,13 +625,13 @@ static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfileByDefault( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfile, BOOL fEnable) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); HKEY key; WCHAR buf[39]; WCHAR buf2[39]; WCHAR fullkey[168]; ULONG res; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("(%p) %s %x %s %i\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfile),fEnable); StringFromGUID2(rclsid, buf, 39); @@ -641,18 +655,16 @@ static HRESULT WINAPI InputProcessorProfiles_SubstituteKeyboardLayout( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfile, HKL hKL) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } - -static const ITfInputProcessorProfilesVtbl InputProcessorProfiles_InputProcessorProfilesVtbl = +static const ITfInputProcessorProfilesVtbl InputProcessorProfilesVtbl = { InputProcessorProfiles_QueryInterface, InputProcessorProfiles_AddRef, InputProcessorProfiles_Release, - InputProcessorProfiles_Register, InputProcessorProfiles_Unregister, InputProcessorProfiles_AddLanguageProfile, @@ -678,27 +690,27 @@ static const ITfInputProcessorProfilesVtbl InputProcessorProfiles_InputProcessor *****************************************************/ static HRESULT WINAPI IPPSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) { - InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); - return InputProcessorProfiles_QueryInterface((ITfInputProcessorProfiles *)This, iid, *ppvOut); + InputProcessorProfiles *This = impl_from_ITfSource(iface); + return ITfInputProcessorProfiles_QueryInterface(&This->ITfInputProcessorProfiles_iface, iid, *ppvOut); } static ULONG WINAPI IPPSource_AddRef(ITfSource *iface) { - InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); - return InputProcessorProfiles_AddRef((ITfInputProcessorProfiles*)This); + InputProcessorProfiles *This = impl_from_ITfSource(iface); + return ITfInputProcessorProfiles_AddRef(&This->ITfInputProcessorProfiles_iface); } static ULONG WINAPI IPPSource_Release(ITfSource *iface) { - InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); - return InputProcessorProfiles_Release((ITfInputProcessorProfiles *)This); + InputProcessorProfiles *This = impl_from_ITfSource(iface); + return ITfInputProcessorProfiles_Release(&This->ITfInputProcessorProfiles_iface); } static HRESULT WINAPI IPPSource_AdviseSink(ITfSource *iface, REFIID riid, IUnknown *punk, DWORD *pdwCookie) { + InputProcessorProfiles *This = impl_from_ITfSource(iface); InputProcessorProfilesSink *ipps; - InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); @@ -731,8 +743,8 @@ static HRESULT WINAPI IPPSource_AdviseSink(ITfSource *iface, static HRESULT WINAPI IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) { + InputProcessorProfiles *This = impl_from_ITfSource(iface); InputProcessorProfilesSink *sink; - InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %x\n",This,pdwCookie); @@ -749,12 +761,11 @@ static HRESULT WINAPI IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) return S_OK; } -static const ITfSourceVtbl InputProcessorProfiles_SourceVtbl = +static const ITfSourceVtbl InputProcessorProfilesSourceVtbl = { IPPSource_QueryInterface, IPPSource_AddRef, IPPSource_Release, - IPPSource_AdviseSink, IPPSource_UnadviseSink, }; @@ -769,8 +780,8 @@ HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut if (This == NULL) return E_OUTOFMEMORY; - This->InputProcessorProfilesVtbl= &InputProcessorProfiles_InputProcessorProfilesVtbl; - This->SourceVtbl = &InputProcessorProfiles_SourceVtbl; + This->ITfInputProcessorProfiles_iface.lpVtbl= &InputProcessorProfilesVtbl; + This->ITfSource_iface.lpVtbl = &InputProcessorProfilesSourceVtbl; This->refCount = 1; This->currentLanguage = GetUserDefaultLCID(); @@ -793,12 +804,12 @@ static void ProfilesEnumGuid_Destructor(ProfilesEnumGuid *This) static HRESULT WINAPI ProfilesEnumGuid_QueryInterface(IEnumGUID *iface, REFIID iid, LPVOID *ppvOut) { - ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumGUID)) { - *ppvOut = This; + *ppvOut = &This->IEnumGUID_iface; } if (*ppvOut) @@ -813,13 +824,13 @@ static HRESULT WINAPI ProfilesEnumGuid_QueryInterface(IEnumGUID *iface, REFIID i static ULONG WINAPI ProfilesEnumGuid_AddRef(IEnumGUID *iface) { - ProfilesEnumGuid *This = (ProfilesEnumGuid*)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI ProfilesEnumGuid_Release(IEnumGUID *iface) { - ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -834,7 +845,7 @@ static ULONG WINAPI ProfilesEnumGuid_Release(IEnumGUID *iface) static HRESULT WINAPI ProfilesEnumGuid_Next( LPENUMGUID iface, ULONG celt, GUID *rgelt, ULONG *pceltFetched) { - ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); ULONG fetched = 0; TRACE("(%p)\n",This); @@ -866,7 +877,7 @@ static HRESULT WINAPI ProfilesEnumGuid_Next( LPENUMGUID iface, static HRESULT WINAPI ProfilesEnumGuid_Skip( LPENUMGUID iface, ULONG celt) { - ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); TRACE("(%p)\n",This); This->next_index += celt; @@ -875,7 +886,7 @@ static HRESULT WINAPI ProfilesEnumGuid_Skip( LPENUMGUID iface, ULONG celt) static HRESULT WINAPI ProfilesEnumGuid_Reset( LPENUMGUID iface) { - ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); TRACE("(%p)\n",This); This->next_index = 0; return S_OK; @@ -884,7 +895,7 @@ static HRESULT WINAPI ProfilesEnumGuid_Reset( LPENUMGUID iface) static HRESULT WINAPI ProfilesEnumGuid_Clone( LPENUMGUID iface, IEnumGUID **ppenum) { - ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); HRESULT res; TRACE("(%p)\n",This); @@ -894,17 +905,17 @@ static HRESULT WINAPI ProfilesEnumGuid_Clone( LPENUMGUID iface, res = ProfilesEnumGuid_Constructor(ppenum); if (SUCCEEDED(res)) { - ProfilesEnumGuid *new_This = (ProfilesEnumGuid *)*ppenum; + ProfilesEnumGuid *new_This = impl_from_IEnumGUID(*ppenum); new_This->next_index = This->next_index; } return res; } -static const IEnumGUIDVtbl IEnumGUID_Vtbl ={ +static const IEnumGUIDVtbl EnumGUIDVtbl = +{ ProfilesEnumGuid_QueryInterface, ProfilesEnumGuid_AddRef, ProfilesEnumGuid_Release, - ProfilesEnumGuid_Next, ProfilesEnumGuid_Skip, ProfilesEnumGuid_Reset, @@ -919,7 +930,7 @@ static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut) if (This == NULL) return E_OUTOFMEMORY; - This->Vtbl= &IEnumGUID_Vtbl; + This->IEnumGUID_iface.lpVtbl= &EnumGUIDVtbl; This->refCount = 1; if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0, @@ -949,12 +960,13 @@ static void EnumTfLanguageProfiles_Destructor(EnumTfLanguageProfiles *This) static HRESULT WINAPI EnumTfLanguageProfiles_QueryInterface(IEnumTfLanguageProfiles *iface, REFIID iid, LPVOID *ppvOut) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); + *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfLanguageProfiles)) { - *ppvOut = This; + *ppvOut = &This->IEnumTfLanguageProfiles_iface; } if (*ppvOut) @@ -969,13 +981,13 @@ static HRESULT WINAPI EnumTfLanguageProfiles_QueryInterface(IEnumTfLanguageProfi static ULONG WINAPI EnumTfLanguageProfiles_AddRef(IEnumTfLanguageProfiles *iface) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles*)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI EnumTfLanguageProfiles_Release(IEnumTfLanguageProfiles *iface) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -1042,7 +1054,7 @@ static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LA static HRESULT WINAPI EnumTfLanguageProfiles_Next(IEnumTfLanguageProfiles *iface, ULONG ulCount, TF_LANGUAGEPROFILE *pProfile, ULONG *pcFetch) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); ULONG fetched = 0; TRACE("(%p)\n",This); @@ -1084,14 +1096,14 @@ static HRESULT WINAPI EnumTfLanguageProfiles_Next(IEnumTfLanguageProfiles *iface static HRESULT WINAPI EnumTfLanguageProfiles_Skip( IEnumTfLanguageProfiles* iface, ULONG celt) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); FIXME("STUB (%p)\n",This); return E_NOTIMPL; } static HRESULT WINAPI EnumTfLanguageProfiles_Reset( IEnumTfLanguageProfiles* iface) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); TRACE("(%p)\n",This); This->tip_index = 0; if (This->langkey) @@ -1104,7 +1116,7 @@ static HRESULT WINAPI EnumTfLanguageProfiles_Reset( IEnumTfLanguageProfiles* ifa static HRESULT WINAPI EnumTfLanguageProfiles_Clone( IEnumTfLanguageProfiles *iface, IEnumTfLanguageProfiles **ppenum) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); HRESULT res; TRACE("(%p)\n",This); @@ -1131,11 +1143,11 @@ static HRESULT WINAPI EnumTfLanguageProfiles_Clone( IEnumTfLanguageProfiles *ifa return res; } -static const IEnumTfLanguageProfilesVtbl IEnumTfLanguageProfiles_Vtbl ={ +static const IEnumTfLanguageProfilesVtbl EnumTfLanguageProfilesVtbl = +{ EnumTfLanguageProfiles_QueryInterface, EnumTfLanguageProfiles_AddRef, EnumTfLanguageProfiles_Release, - EnumTfLanguageProfiles_Clone, EnumTfLanguageProfiles_Next, EnumTfLanguageProfiles_Reset, @@ -1151,7 +1163,7 @@ static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguage if (This == NULL) return E_OUTOFMEMORY; - This->Vtbl= &IEnumTfLanguageProfiles_Vtbl; + This->IEnumTfLanguageProfiles_iface.lpVtbl= &EnumTfLanguageProfilesVtbl; This->refCount = 1; This->langid = langid; diff --git a/dlls/msctf/langbarmgr.c b/dlls/msctf/langbarmgr.c index cf9e4a33e09..29f5f26a6e1 100644 --- a/dlls/msctf/langbarmgr.c +++ b/dlls/msctf/langbarmgr.c @@ -56,7 +56,7 @@ static HRESULT WINAPI LangBarMgr_QueryInterface(ITfLangBarMgr *iface, REFIID iid if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfLangBarMgr)) { - *ppvOut = This; + *ppvOut = &This->ITfLangBarMgr_iface; } if (*ppvOut) diff --git a/dlls/msctf/range.c b/dlls/msctf/range.c index ae5129b8e5c..566e064f215 100644 --- a/dlls/msctf/range.c +++ b/dlls/msctf/range.c @@ -72,7 +72,7 @@ static HRESULT WINAPI Range_QueryInterface(ITfRange *iface, REFIID iid, LPVOID * if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfRange)) { - *ppvOut = This; + *ppvOut = &This->ITfRange_iface; } if (*ppvOut) @@ -359,7 +359,7 @@ HRESULT TF_SELECTION_to_TS_SELECTION_ACP(const TF_SELECTION *tf, TS_SELECTION_AC if (!tf || !tsAcp || !tf->range) return E_INVALIDARG; - This = (Range *)tf->range; + This = impl_from_ITfRange(tf->range); tsAcp->acpStart = This->anchorStart; tsAcp->acpEnd = This->anchorEnd; diff --git a/dlls/msctf/threadmgr.c b/dlls/msctf/threadmgr.c index 48f33c7d836..1d62ac76db9 100644 --- a/dlls/msctf/threadmgr.c +++ b/dlls/msctf/threadmgr.c @@ -79,22 +79,22 @@ typedef struct tagAssociatedWindow } AssociatedWindow; typedef struct tagACLMulti { - const ITfThreadMgrVtbl *ThreadMgrVtbl; - const ITfSourceVtbl *SourceVtbl; - const ITfKeystrokeMgrVtbl *KeystrokeMgrVtbl; - const ITfMessagePumpVtbl *MessagePumpVtbl; - const ITfClientIdVtbl *ClientIdVtbl; + ITfThreadMgr ITfThreadMgr_iface; + ITfSource ITfSource_iface; + ITfKeystrokeMgr ITfKeystrokeMgr_iface; + ITfMessagePump ITfMessagePump_iface; + ITfClientId ITfClientId_iface; /* const ITfThreadMgrExVtbl *ThreadMgrExVtbl; */ /* const ITfConfigureSystemKeystrokeFeedVtbl *ConfigureSystemKeystrokeFeedVtbl; */ /* const ITfLangBarItemMgrVtbl *LangBarItemMgrVtbl; */ /* const ITfUIElementMgrVtbl *UIElementMgrVtbl; */ - const ITfSourceSingleVtbl *SourceSingleVtbl; + ITfSourceSingle ITfSourceSingle_iface; LONG refCount; /* Aggregation */ ITfCompartmentMgr *CompartmentMgr; - const ITfThreadMgrEventSinkVtbl *ThreadMgrEventSinkVtbl; /* internal */ + ITfThreadMgrEventSink ITfThreadMgrEventSink_iface; /* internal */ ITfDocumentMgr *focus; LONG activationCount; @@ -118,7 +118,7 @@ typedef struct tagACLMulti { } ThreadMgr; typedef struct tagEnumTfDocumentMgr { - const IEnumTfDocumentMgrsVtbl *Vtbl; + IEnumTfDocumentMgrs IEnumTfDocumentMgrs_iface; LONG refCount; struct list *index; @@ -127,35 +127,44 @@ typedef struct tagEnumTfDocumentMgr { static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentMgrs **ppOut); -static inline ThreadMgr *impl_from_ITfSourceVtbl(ITfSource *iface) +static inline ThreadMgr *impl_from_ITfThreadMgr(ITfThreadMgr *iface) { - return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,SourceVtbl)); + return CONTAINING_RECORD(iface, ThreadMgr, ITfThreadMgr_iface); } -static inline ThreadMgr *impl_from_ITfKeystrokeMgrVtbl(ITfKeystrokeMgr *iface) +static inline ThreadMgr *impl_from_ITfSource(ITfSource *iface) { - return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,KeystrokeMgrVtbl)); + return CONTAINING_RECORD(iface, ThreadMgr, ITfSource_iface); } -static inline ThreadMgr *impl_from_ITfMessagePumpVtbl(ITfMessagePump *iface) +static inline ThreadMgr *impl_from_ITfKeystrokeMgr(ITfKeystrokeMgr *iface) { - return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,MessagePumpVtbl)); + return CONTAINING_RECORD(iface, ThreadMgr, ITfKeystrokeMgr_iface); } -static inline ThreadMgr *impl_from_ITfClientIdVtbl(ITfClientId *iface) +static inline ThreadMgr *impl_from_ITfMessagePump(ITfMessagePump *iface) { - return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,ClientIdVtbl)); + return CONTAINING_RECORD(iface, ThreadMgr, ITfMessagePump_iface); +} + +static inline ThreadMgr *impl_from_ITfClientId(ITfClientId *iface) +{ + return CONTAINING_RECORD(iface, ThreadMgr, ITfClientId_iface); } static inline ThreadMgr *impl_from_ITfThreadMgrEventSink(ITfThreadMgrEventSink *iface) { - return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,ThreadMgrEventSinkVtbl)); + return CONTAINING_RECORD(iface, ThreadMgr, ITfThreadMgrEventSink_iface); } -static inline ThreadMgr *impl_from_ITfSourceSingleVtbl(ITfSourceSingle* iface) - +static inline ThreadMgr *impl_from_ITfSourceSingle(ITfSourceSingle *iface) { - return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,SourceSingleVtbl)); + return CONTAINING_RECORD(iface, ThreadMgr, ITfSourceSingle_iface); +} + +static inline EnumTfDocumentMgr *impl_from_IEnumTfDocumentMgrs(IEnumTfDocumentMgrs *iface) +{ + return CONTAINING_RECORD(iface, EnumTfDocumentMgr, IEnumTfDocumentMgrs_iface); } static void free_sink(ThreadMgrSink *sink) @@ -245,28 +254,28 @@ static void ThreadMgr_Destructor(ThreadMgr *This) static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, LPVOID *ppvOut) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfThreadMgr)) { - *ppvOut = This; + *ppvOut = &This->ITfThreadMgr_iface; } else if (IsEqualIID(iid, &IID_ITfSource)) { - *ppvOut = &This->SourceVtbl; + *ppvOut = &This->ITfSource_iface; } else if (IsEqualIID(iid, &IID_ITfKeystrokeMgr)) { - *ppvOut = &This->KeystrokeMgrVtbl; + *ppvOut = &This->ITfKeystrokeMgr_iface; } else if (IsEqualIID(iid, &IID_ITfMessagePump)) { - *ppvOut = &This->MessagePumpVtbl; + *ppvOut = &This->ITfMessagePump_iface; } else if (IsEqualIID(iid, &IID_ITfClientId)) { - *ppvOut = &This->ClientIdVtbl; + *ppvOut = &This->ITfClientId_iface; } else if (IsEqualIID(iid, &IID_ITfCompartmentMgr)) { @@ -274,7 +283,7 @@ static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, } else if (IsEqualIID(iid, &IID_ITfSourceSingle)) { - *ppvOut = &This->SourceSingleVtbl; + *ppvOut = &This->ITfSourceSingle_iface; } if (*ppvOut) @@ -289,13 +298,13 @@ static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, static ULONG WINAPI ThreadMgr_AddRef(ITfThreadMgr *iface) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -310,7 +319,7 @@ static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface) static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *ptid) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); TRACE("(%p) %p\n",This, ptid); @@ -321,7 +330,7 @@ static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *pti { GUID guid; CoCreateGuid(&guid); - ITfClientId_GetClientId((ITfClientId*)&This->ClientIdVtbl,&guid,&processId); + ITfClientId_GetClientId(&This->ITfClientId_iface, &guid, &processId); } activate_textservices(iface); @@ -332,7 +341,7 @@ static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *pti static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); TRACE("(%p)\n",This); if (This->activationCount == 0) @@ -344,7 +353,7 @@ static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface) { if (This->focus) { - ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, 0, This->focus); + ITfThreadMgrEventSink_OnSetFocus(&This->ITfThreadMgrEventSink_iface, 0, This->focus); ITfDocumentMgr_Release(This->focus); This->focus = 0; } @@ -355,10 +364,9 @@ static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface) return S_OK; } -static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocumentMgr -**ppdim) +static HRESULT WINAPI ThreadMgr_CreateDocumentMgr(ITfThreadMgr* iface, ITfDocumentMgr **ppdim) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); DocumentMgrEntry *mgrentry; HRESULT hr; @@ -367,7 +375,7 @@ static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocum if (mgrentry == NULL) return E_OUTOFMEMORY; - hr = DocumentMgr_Constructor((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, ppdim); + hr = DocumentMgr_Constructor(&This->ITfThreadMgrEventSink_iface, ppdim); if (SUCCEEDED(hr)) { @@ -380,10 +388,9 @@ static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocum return hr; } -static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDocumentMgrs -**ppEnum) +static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDocumentMgrs **ppEnum) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); TRACE("(%p) %p\n",This,ppEnum); if (!ppEnum) @@ -395,7 +402,7 @@ static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDo static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr **ppdimFocus) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); TRACE("(%p)\n",This); if (!ppdimFocus) @@ -415,8 +422,8 @@ static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *pdimFocus) { + ThreadMgr *This = impl_from_ITfThreadMgr(iface); ITfDocumentMgr *check; - ThreadMgr *This = (ThreadMgr *)iface; TRACE("(%p) %p\n",This,pdimFocus); @@ -425,7 +432,7 @@ static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *p else if (FAILED(ITfDocumentMgr_QueryInterface(pdimFocus,&IID_ITfDocumentMgr,(LPVOID*) &check))) return E_INVALIDARG; - ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, check, This->focus); + ITfThreadMgrEventSink_OnSetFocus(&This->ITfThreadMgrEventSink_iface, check, This->focus); if (This->focus) ITfDocumentMgr_Release(This->focus); @@ -489,8 +496,8 @@ static HRESULT SetupWindowsHook(ThreadMgr *This) static HRESULT WINAPI ThreadMgr_AssociateFocus( ITfThreadMgr* iface, HWND hwnd, ITfDocumentMgr *pdimNew, ITfDocumentMgr **ppdimPrev) { + ThreadMgr *This = impl_from_ITfThreadMgr(iface); struct list *cursor, *cursor2; - ThreadMgr *This = (ThreadMgr *)iface; AssociatedWindow *wnd; TRACE("(%p) %p %p %p\n",This,hwnd,pdimNew,ppdimPrev); @@ -530,8 +537,9 @@ ITfDocumentMgr *pdimNew, ITfDocumentMgr **ppdimPrev) static HRESULT WINAPI ThreadMgr_IsThreadFocus( ITfThreadMgr* iface, BOOL *pfThreadFocus) { + ThreadMgr *This = impl_from_ITfThreadMgr(iface); HWND focus; - ThreadMgr *This = (ThreadMgr *)iface; + TRACE("(%p) %p\n",This,pfThreadFocus); focus = GetFocus(); *pfThreadFocus = (focus == NULL); @@ -541,7 +549,7 @@ static HRESULT WINAPI ThreadMgr_IsThreadFocus( ITfThreadMgr* iface, BOOL *pfThre static HRESULT WINAPI ThreadMgr_GetFunctionProvider( ITfThreadMgr* iface, REFCLSID clsid, ITfFunctionProvider **ppFuncProv) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -549,7 +557,7 @@ ITfFunctionProvider **ppFuncProv) static HRESULT WINAPI ThreadMgr_EnumFunctionProviders( ITfThreadMgr* iface, IEnumTfFunctionProviders **ppEnum) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -557,7 +565,7 @@ IEnumTfFunctionProviders **ppEnum) static HRESULT WINAPI ThreadMgr_GetGlobalCompartment( ITfThreadMgr* iface, ITfCompartmentMgr **ppCompMgr) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); HRESULT hr; TRACE("(%p) %p\n",This, ppCompMgr); @@ -576,12 +584,11 @@ ITfCompartmentMgr **ppCompMgr) return S_OK; } -static const ITfThreadMgrVtbl ThreadMgr_ThreadMgrVtbl = +static const ITfThreadMgrVtbl ThreadMgrVtbl = { ThreadMgr_QueryInterface, ThreadMgr_AddRef, ThreadMgr_Release, - ThreadMgr_fnActivate, ThreadMgr_fnDeactivate, ThreadMgr_CreateDocumentMgr, @@ -595,23 +602,22 @@ static const ITfThreadMgrVtbl ThreadMgr_ThreadMgrVtbl = ThreadMgr_GetGlobalCompartment }; - static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) { - ThreadMgr *This = impl_from_ITfSourceVtbl(iface); - return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); + ThreadMgr *This = impl_from_ITfSource(iface); + return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, *ppvOut); } static ULONG WINAPI Source_AddRef(ITfSource *iface) { - ThreadMgr *This = impl_from_ITfSourceVtbl(iface); - return ThreadMgr_AddRef((ITfThreadMgr*)This); + ThreadMgr *This = impl_from_ITfSource(iface); + return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); } static ULONG WINAPI Source_Release(ITfSource *iface) { - ThreadMgr *This = impl_from_ITfSourceVtbl(iface); - return ThreadMgr_Release((ITfThreadMgr *)This); + ThreadMgr *This = impl_from_ITfSource(iface); + return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); } /***************************************************** @@ -620,8 +626,8 @@ static ULONG WINAPI Source_Release(ITfSource *iface) static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface, REFIID riid, IUnknown *punk, DWORD *pdwCookie) { + ThreadMgr *This = impl_from_ITfSource(iface); ThreadMgrSink *tms; - ThreadMgr *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); @@ -654,8 +660,8 @@ static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface, static HRESULT WINAPI ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) { + ThreadMgr *This = impl_from_ITfSource(iface); ThreadMgrSink *sink; - ThreadMgr *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %x\n",This,pdwCookie); @@ -672,12 +678,11 @@ static HRESULT WINAPI ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCo return S_OK; } -static const ITfSourceVtbl ThreadMgr_SourceVtbl = +static const ITfSourceVtbl ThreadMgrSourceVtbl = { Source_QueryInterface, Source_AddRef, Source_Release, - ThreadMgrSource_AdviseSink, ThreadMgrSource_UnadviseSink, }; @@ -688,26 +693,26 @@ static const ITfSourceVtbl ThreadMgr_SourceVtbl = static HRESULT WINAPI KeystrokeMgr_QueryInterface(ITfKeystrokeMgr *iface, REFIID iid, LPVOID *ppvOut) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); - return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); + return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, *ppvOut); } static ULONG WINAPI KeystrokeMgr_AddRef(ITfKeystrokeMgr *iface) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); - return ThreadMgr_AddRef((ITfThreadMgr*)This); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); + return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); } static ULONG WINAPI KeystrokeMgr_Release(ITfKeystrokeMgr *iface) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); - return ThreadMgr_Release((ITfThreadMgr *)This); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); + return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); } static HRESULT WINAPI KeystrokeMgr_AdviseKeyEventSink(ITfKeystrokeMgr *iface, TfClientId tid, ITfKeyEventSink *pSink, BOOL fForeground) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); CLSID textservice; ITfKeyEventSink *check = NULL; @@ -747,7 +752,7 @@ static HRESULT WINAPI KeystrokeMgr_AdviseKeyEventSink(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface, TfClientId tid) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); CLSID textservice; ITfKeyEventSink *check = NULL; TRACE("(%p) %x\n",This,tid); @@ -779,7 +784,7 @@ static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_GetForeground(ITfKeystrokeMgr *iface, CLSID *pclsid) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); TRACE("(%p) %p\n",This,pclsid); if (!pclsid) return E_INVALIDARG; @@ -794,7 +799,7 @@ static HRESULT WINAPI KeystrokeMgr_GetForeground(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_TestKeyDown(ITfKeystrokeMgr *iface, WPARAM wParam, LPARAM lParam, BOOL *pfEaten) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -802,7 +807,7 @@ static HRESULT WINAPI KeystrokeMgr_TestKeyDown(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_TestKeyUp(ITfKeystrokeMgr *iface, WPARAM wParam, LPARAM lParam, BOOL *pfEaten) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -810,7 +815,7 @@ static HRESULT WINAPI KeystrokeMgr_TestKeyUp(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_KeyDown(ITfKeystrokeMgr *iface, WPARAM wParam, LPARAM lParam, BOOL *pfEaten) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -818,7 +823,7 @@ static HRESULT WINAPI KeystrokeMgr_KeyDown(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_KeyUp(ITfKeystrokeMgr *iface, WPARAM wParam, LPARAM lParam, BOOL *pfEaten) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -826,7 +831,7 @@ static HRESULT WINAPI KeystrokeMgr_KeyUp(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_GetPreservedKey(ITfKeystrokeMgr *iface, ITfContext *pic, const TF_PRESERVEDKEY *pprekey, GUID *pguid) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -834,7 +839,7 @@ static HRESULT WINAPI KeystrokeMgr_GetPreservedKey(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_IsPreservedKey(ITfKeystrokeMgr *iface, REFGUID rguid, const TF_PRESERVEDKEY *pprekey, BOOL *pfRegistered) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); struct list *cursor; TRACE("(%p) %s (%x %x) %p\n",This,debugstr_guid(rguid), (pprekey)?pprekey->uVKey:0, (pprekey)?pprekey->uModifiers:0, pfRegistered); @@ -860,7 +865,7 @@ static HRESULT WINAPI KeystrokeMgr_PreserveKey(ITfKeystrokeMgr *iface, TfClientId tid, REFGUID rguid, const TF_PRESERVEDKEY *prekey, const WCHAR *pchDesc, ULONG cchDesc) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); struct list *cursor; PreservedKey *newkey; @@ -903,7 +908,7 @@ static HRESULT WINAPI KeystrokeMgr_PreserveKey(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_UnpreserveKey(ITfKeystrokeMgr *iface, REFGUID rguid, const TF_PRESERVEDKEY *pprekey) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); PreservedKey* key = NULL; struct list *cursor; TRACE("(%p) %s (%x %x)\n",This,debugstr_guid(rguid),(pprekey)?pprekey->uVKey:0, (pprekey)?pprekey->uModifiers:0); @@ -932,7 +937,7 @@ static HRESULT WINAPI KeystrokeMgr_UnpreserveKey(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_SetPreservedKeyDescription(ITfKeystrokeMgr *iface, REFGUID rguid, const WCHAR *pchDesc, ULONG cchDesc) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -940,7 +945,7 @@ static HRESULT WINAPI KeystrokeMgr_SetPreservedKeyDescription(ITfKeystrokeMgr *i static HRESULT WINAPI KeystrokeMgr_GetPreservedKeyDescription(ITfKeystrokeMgr *iface, REFGUID rguid, BSTR *pbstrDesc) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -948,17 +953,16 @@ static HRESULT WINAPI KeystrokeMgr_GetPreservedKeyDescription(ITfKeystrokeMgr *i static HRESULT WINAPI KeystrokeMgr_SimulatePreservedKey(ITfKeystrokeMgr *iface, ITfContext *pic, REFGUID rguid, BOOL *pfEaten) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } -static const ITfKeystrokeMgrVtbl ThreadMgr_KeystrokeMgrVtbl = +static const ITfKeystrokeMgrVtbl KeystrokeMgrVtbl = { KeystrokeMgr_QueryInterface, KeystrokeMgr_AddRef, KeystrokeMgr_Release, - KeystrokeMgr_AdviseKeyEventSink, KeystrokeMgr_UnadviseKeyEventSink, KeystrokeMgr_GetForeground, @@ -981,20 +985,20 @@ static const ITfKeystrokeMgrVtbl ThreadMgr_KeystrokeMgrVtbl = static HRESULT WINAPI MessagePump_QueryInterface(ITfMessagePump *iface, REFIID iid, LPVOID *ppvOut) { - ThreadMgr *This = impl_from_ITfMessagePumpVtbl(iface); - return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); + ThreadMgr *This = impl_from_ITfMessagePump(iface); + return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, *ppvOut); } static ULONG WINAPI MessagePump_AddRef(ITfMessagePump *iface) { - ThreadMgr *This = impl_from_ITfMessagePumpVtbl(iface); - return ThreadMgr_AddRef((ITfThreadMgr*)This); + ThreadMgr *This = impl_from_ITfMessagePump(iface); + return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); } static ULONG WINAPI MessagePump_Release(ITfMessagePump *iface) { - ThreadMgr *This = impl_from_ITfMessagePumpVtbl(iface); - return ThreadMgr_Release((ITfThreadMgr *)This); + ThreadMgr *This = impl_from_ITfMessagePump(iface); + return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); } static HRESULT WINAPI MessagePump_PeekMessageA(ITfMessagePump *iface, @@ -1037,12 +1041,11 @@ static HRESULT WINAPI MessagePump_GetMessageW(ITfMessagePump *iface, return S_OK; } -static const ITfMessagePumpVtbl ThreadMgr_MessagePumpVtbl = +static const ITfMessagePumpVtbl MessagePumpVtbl = { MessagePump_QueryInterface, MessagePump_AddRef, MessagePump_Release, - MessagePump_PeekMessageA, MessagePump_GetMessageA, MessagePump_PeekMessageW, @@ -1055,29 +1058,29 @@ static const ITfMessagePumpVtbl ThreadMgr_MessagePumpVtbl = static HRESULT WINAPI ClientId_QueryInterface(ITfClientId *iface, REFIID iid, LPVOID *ppvOut) { - ThreadMgr *This = impl_from_ITfClientIdVtbl(iface); - return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); + ThreadMgr *This = impl_from_ITfClientId(iface); + return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, *ppvOut); } static ULONG WINAPI ClientId_AddRef(ITfClientId *iface) { - ThreadMgr *This = impl_from_ITfClientIdVtbl(iface); - return ThreadMgr_AddRef((ITfThreadMgr*)This); + ThreadMgr *This = impl_from_ITfClientId(iface); + return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); } static ULONG WINAPI ClientId_Release(ITfClientId *iface) { - ThreadMgr *This = impl_from_ITfClientIdVtbl(iface); - return ThreadMgr_Release((ITfThreadMgr *)This); + ThreadMgr *This = impl_from_ITfClientId(iface); + return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); } static HRESULT WINAPI ClientId_GetClientId(ITfClientId *iface, REFCLSID rclsid, TfClientId *ptid) { + ThreadMgr *This = impl_from_ITfClientId(iface); HRESULT hr; ITfCategoryMgr *catmgr; - ThreadMgr *This = impl_from_ITfClientIdVtbl(iface); TRACE("(%p) %s\n",This,debugstr_guid(rclsid)); @@ -1088,12 +1091,11 @@ static HRESULT WINAPI ClientId_GetClientId(ITfClientId *iface, return hr; } -static const ITfClientIdVtbl ThreadMgr_ClientIdVtbl = +static const ITfClientIdVtbl ClientIdVtbl = { ClientId_QueryInterface, ClientId_AddRef, ClientId_Release, - ClientId_GetClientId }; @@ -1103,19 +1105,19 @@ static const ITfClientIdVtbl ThreadMgr_ClientIdVtbl = static HRESULT WINAPI ThreadMgrEventSink_QueryInterface(ITfThreadMgrEventSink *iface, REFIID iid, LPVOID *ppvOut) { ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); - return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); + return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, *ppvOut); } static ULONG WINAPI ThreadMgrEventSink_AddRef(ITfThreadMgrEventSink *iface) { ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); - return ThreadMgr_AddRef((ITfThreadMgr*)This); + return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); } static ULONG WINAPI ThreadMgrEventSink_Release(ITfThreadMgrEventSink *iface) { ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); - return ThreadMgr_Release((ITfThreadMgr *)This); + return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); } @@ -1205,12 +1207,11 @@ static HRESULT WINAPI ThreadMgrEventSink_OnPopContext( return S_OK; } -static const ITfThreadMgrEventSinkVtbl ThreadMgr_ThreadMgrEventSinkVtbl = +static const ITfThreadMgrEventSinkVtbl ThreadMgrEventSinkVtbl = { ThreadMgrEventSink_QueryInterface, ThreadMgrEventSink_AddRef, ThreadMgrEventSink_Release, - ThreadMgrEventSink_OnInitDocumentMgr, ThreadMgrEventSink_OnUninitDocumentMgr, ThreadMgrEventSink_OnSetFocus, @@ -1223,26 +1224,26 @@ static const ITfThreadMgrEventSinkVtbl ThreadMgr_ThreadMgrEventSinkVtbl = *****************************************************/ static HRESULT WINAPI ThreadMgrSourceSingle_QueryInterface(ITfSourceSingle *iface, REFIID iid, LPVOID *ppvOut) { - ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); - return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); + ThreadMgr *This = impl_from_ITfSourceSingle(iface); + return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, *ppvOut); } static ULONG WINAPI ThreadMgrSourceSingle_AddRef(ITfSourceSingle *iface) { - ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); - return ThreadMgr_AddRef((ITfThreadMgr *)This); + ThreadMgr *This = impl_from_ITfSourceSingle(iface); + return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); } static ULONG WINAPI ThreadMgrSourceSingle_Release(ITfSourceSingle *iface) { - ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); - return ThreadMgr_Release((ITfThreadMgr *)This); + ThreadMgr *This = impl_from_ITfSourceSingle(iface); + return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); } static HRESULT WINAPI ThreadMgrSourceSingle_AdviseSingleSink( ITfSourceSingle *iface, TfClientId tid, REFIID riid, IUnknown *punk) { - ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); + ThreadMgr *This = impl_from_ITfSourceSingle(iface); FIXME("STUB:(%p) %i %s %p\n",This, tid, debugstr_guid(riid),punk); return E_NOTIMPL; } @@ -1250,19 +1251,18 @@ static HRESULT WINAPI ThreadMgrSourceSingle_AdviseSingleSink( ITfSourceSingle *i static HRESULT WINAPI ThreadMgrSourceSingle_UnadviseSingleSink( ITfSourceSingle *iface, TfClientId tid, REFIID riid) { - ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); + ThreadMgr *This = impl_from_ITfSourceSingle(iface); FIXME("STUB:(%p) %i %s\n",This, tid, debugstr_guid(riid)); return E_NOTIMPL; } -static const ITfSourceSingleVtbl ThreadMgr_SourceSingleVtbl = +static const ITfSourceSingleVtbl SourceSingleVtbl = { ThreadMgrSourceSingle_QueryInterface, ThreadMgrSourceSingle_AddRef, ThreadMgrSourceSingle_Release, - ThreadMgrSourceSingle_AdviseSingleSink, - ThreadMgrSourceSingle_UnadviseSingleSink, + ThreadMgrSourceSingle_UnadviseSingleSink }; HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) @@ -1275,8 +1275,8 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) This = TlsGetValue(tlsIndex); if (This) { - ThreadMgr_AddRef((ITfThreadMgr*)This); - *ppOut = (IUnknown*)This; + ThreadMgr_AddRef(&This->ITfThreadMgr_iface); + *ppOut = (IUnknown*)&This->ITfThreadMgr_iface; return S_OK; } @@ -1284,13 +1284,13 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) if (This == NULL) return E_OUTOFMEMORY; - This->ThreadMgrVtbl= &ThreadMgr_ThreadMgrVtbl; - This->SourceVtbl = &ThreadMgr_SourceVtbl; - This->KeystrokeMgrVtbl= &ThreadMgr_KeystrokeMgrVtbl; - This->MessagePumpVtbl= &ThreadMgr_MessagePumpVtbl; - This->ClientIdVtbl = &ThreadMgr_ClientIdVtbl; - This->ThreadMgrEventSinkVtbl = &ThreadMgr_ThreadMgrEventSinkVtbl; - This->SourceSingleVtbl = &ThreadMgr_SourceSingleVtbl; + This->ITfThreadMgr_iface.lpVtbl= &ThreadMgrVtbl; + This->ITfSource_iface.lpVtbl = &ThreadMgrSourceVtbl; + This->ITfKeystrokeMgr_iface.lpVtbl= &KeystrokeMgrVtbl; + This->ITfMessagePump_iface.lpVtbl = &MessagePumpVtbl; + This->ITfClientId_iface.lpVtbl = &ClientIdVtbl; + This->ITfThreadMgrEventSink_iface.lpVtbl = &ThreadMgrEventSinkVtbl; + This->ITfSourceSingle_iface.lpVtbl = &SourceSingleVtbl; This->refCount = 1; TlsSetValue(tlsIndex,This); @@ -1308,7 +1308,7 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) list_init(&This->ThreadMgrEventSink); TRACE("returning %p\n", This); - *ppOut = (IUnknown *)This; + *ppOut = (IUnknown *)&This->ITfThreadMgr_iface; return S_OK; } @@ -1323,12 +1323,12 @@ static void EnumTfDocumentMgr_Destructor(EnumTfDocumentMgr *This) static HRESULT WINAPI EnumTfDocumentMgr_QueryInterface(IEnumTfDocumentMgrs *iface, REFIID iid, LPVOID *ppvOut) { - EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfDocumentMgrs)) { - *ppvOut = This; + *ppvOut = &This->IEnumTfDocumentMgrs_iface; } if (*ppvOut) @@ -1343,13 +1343,13 @@ static HRESULT WINAPI EnumTfDocumentMgr_QueryInterface(IEnumTfDocumentMgrs *ifac static ULONG WINAPI EnumTfDocumentMgr_AddRef(IEnumTfDocumentMgrs *iface) { - EnumTfDocumentMgr *This = (EnumTfDocumentMgr*)iface; + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI EnumTfDocumentMgr_Release(IEnumTfDocumentMgrs *iface) { - EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -1361,7 +1361,7 @@ static ULONG WINAPI EnumTfDocumentMgr_Release(IEnumTfDocumentMgrs *iface) static HRESULT WINAPI EnumTfDocumentMgr_Next(IEnumTfDocumentMgrs *iface, ULONG ulCount, ITfDocumentMgr **rgDocumentMgr, ULONG *pcFetched) { - EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); ULONG fetched = 0; TRACE("(%p)\n",This); @@ -1392,8 +1392,9 @@ static HRESULT WINAPI EnumTfDocumentMgr_Next(IEnumTfDocumentMgrs *iface, static HRESULT WINAPI EnumTfDocumentMgr_Skip( IEnumTfDocumentMgrs* iface, ULONG celt) { + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); ULONG i; - EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; + TRACE("(%p)\n",This); for(i = 0; i < celt && This->index != NULL; i++) This->index = list_next(This->head, This->index); @@ -1402,7 +1403,7 @@ static HRESULT WINAPI EnumTfDocumentMgr_Skip( IEnumTfDocumentMgrs* iface, ULONG static HRESULT WINAPI EnumTfDocumentMgr_Reset( IEnumTfDocumentMgrs* iface) { - EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); TRACE("(%p)\n",This); This->index = list_head(This->head); return S_OK; @@ -1411,7 +1412,7 @@ static HRESULT WINAPI EnumTfDocumentMgr_Reset( IEnumTfDocumentMgrs* iface) static HRESULT WINAPI EnumTfDocumentMgr_Clone( IEnumTfDocumentMgrs *iface, IEnumTfDocumentMgrs **ppenum) { - EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); HRESULT res; TRACE("(%p)\n",This); @@ -1421,17 +1422,17 @@ static HRESULT WINAPI EnumTfDocumentMgr_Clone( IEnumTfDocumentMgrs *iface, res = EnumTfDocumentMgr_Constructor(This->head, ppenum); if (SUCCEEDED(res)) { - EnumTfDocumentMgr *new_This = (EnumTfDocumentMgr *)*ppenum; + EnumTfDocumentMgr *new_This = impl_from_IEnumTfDocumentMgrs(*ppenum); new_This->index = This->index; } return res; } -static const IEnumTfDocumentMgrsVtbl IEnumTfDocumentMgrs_Vtbl ={ +static const IEnumTfDocumentMgrsVtbl EnumTfDocumentMgrsVtbl = +{ EnumTfDocumentMgr_QueryInterface, EnumTfDocumentMgr_AddRef, EnumTfDocumentMgr_Release, - EnumTfDocumentMgr_Clone, EnumTfDocumentMgr_Next, EnumTfDocumentMgr_Reset, @@ -1446,7 +1447,7 @@ static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentM if (This == NULL) return E_OUTOFMEMORY; - This->Vtbl= &IEnumTfDocumentMgrs_Vtbl; + This->IEnumTfDocumentMgrs_iface.lpVtbl= &EnumTfDocumentMgrsVtbl; This->refCount = 1; This->head = head; This->index = list_head(This->head); @@ -1456,9 +1457,9 @@ static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentM return S_OK; } -void ThreadMgr_OnDocumentMgrDestruction(ITfThreadMgr *tm, ITfDocumentMgr *mgr) +void ThreadMgr_OnDocumentMgrDestruction(ITfThreadMgr *iface, ITfDocumentMgr *mgr) { - ThreadMgr *This = (ThreadMgr *)tm; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); struct list *cursor; LIST_FOR_EACH(cursor, &This->CreatedDocumentMgrs) {