[MSCTF]
authorAmine Khaldi <amine.khaldi@reactos.org>
Wed, 23 Apr 2014 14:32:35 +0000 (14:32 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Wed, 23 Apr 2014 14:32:35 +0000 (14:32 +0000)
* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62915

13 files changed:
reactos/dll/win32/msctf/categorymgr.c
reactos/dll/win32/msctf/compartmentmgr.c
reactos/dll/win32/msctf/context.c
reactos/dll/win32/msctf/displayattributemgr.c
reactos/dll/win32/msctf/documentmgr.c
reactos/dll/win32/msctf/inputprocessor.c
reactos/dll/win32/msctf/langbarmgr.c
reactos/dll/win32/msctf/msctf_classes.idl
reactos/dll/win32/msctf/msctf_classes.rgs [moved from reactos/dll/win32/msctf/msctf.rgs with 100% similarity]
reactos/dll/win32/msctf/range.c
reactos/dll/win32/msctf/threadmgr.c
reactos/dll/win32/msctf/version.rc
reactos/media/doc/README.WINE

index 01f9420..509494f 100644 (file)
@@ -43,7 +43,7 @@ static HRESULT WINAPI CategoryMgr_QueryInterface(ITfCategoryMgr *iface, REFIID i
 
     if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfCategoryMgr))
     {
-        *ppvOut = This;
+        *ppvOut = &This->ITfCategoryMgr_iface;
     }
 
     if (*ppvOut)
@@ -371,12 +371,11 @@ static HRESULT WINAPI CategoryMgr_IsEqualTfGuidAtom ( ITfCategoryMgr *iface,
 }
 
 
-static const ITfCategoryMgrVtbl CategoryMgr_CategoryMgrVtbl =
+static const ITfCategoryMgrVtbl CategoryMgrVtbl =
 {
     CategoryMgr_QueryInterface,
     CategoryMgr_AddRef,
     CategoryMgr_Release,
-
     CategoryMgr_RegisterCategory,
     CategoryMgr_UnregisterCategory,
     CategoryMgr_EnumCategoriesInItem,
@@ -403,10 +402,10 @@ HRESULT CategoryMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
     if (This == NULL)
         return E_OUTOFMEMORY;
 
-    This->ITfCategoryMgr_iface.lpVtbl = &CategoryMgr_CategoryMgrVtbl;
+    This->ITfCategoryMgr_iface.lpVtbl = &CategoryMgrVtbl;
     This->refCount = 1;
 
-    TRACE("returning %p\n", This);
-    *ppOut = (IUnknown *)This;
+    *ppOut = (IUnknown *)&This->ITfCategoryMgr_iface;
+    TRACE("returning %p\n", *ppOut);
     return S_OK;
 }
index e356bb6..17dc2d6 100644 (file)
@@ -30,7 +30,7 @@ typedef struct tagCompartmentValue {
 } CompartmentValue;
 
 typedef struct tagCompartmentMgr {
-    const ITfCompartmentMgrVtbl *CompartmentMgrVtbl;
+    ITfCompartmentMgr ITfCompartmentMgr_iface;
     LONG refCount;
 
     IUnknown *pUnkOuter;
@@ -39,7 +39,7 @@ typedef struct tagCompartmentMgr {
 } CompartmentMgr;
 
 typedef struct tagCompartmentEnumGuid {
-    const IEnumGUIDVtbl *Vtbl;
+    IEnumGUID IEnumGUID_iface;
     LONG refCount;
 
     struct list *values;
@@ -56,8 +56,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 */
@@ -69,14 +69,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)
@@ -96,16 +111,16 @@ 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);
+        return IUnknown_QueryInterface(This->pUnkOuter, iid, ppvOut);
     else
     {
         *ppvOut = NULL;
 
         if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfCompartmentMgr))
         {
-            *ppvOut = This;
+            *ppvOut = &This->ITfCompartmentMgr_iface;
         }
 
         if (*ppvOut)
@@ -121,7 +136,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
@@ -130,7 +145,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
@@ -147,7 +162,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;
@@ -186,8 +201,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)
@@ -210,19 +226,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
@@ -242,20 +258,20 @@ 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);
 
     if (pUnkOuter)
     {
-        TRACE("returning %p\n", This);
-        *ppOut = (IUnknown*)This;
+        *ppOut = (IUnknown*)&This->ITfCompartmentMgr_iface;
+        TRACE("returning %p\n", *ppOut);
         return S_OK;
     }
     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;
@@ -273,12 +289,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)
@@ -293,13 +309,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);
@@ -311,10 +327,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);
@@ -338,27 +354,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);
@@ -368,17 +384,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,
@@ -393,14 +409,14 @@ 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;
     This->cursor = list_head(values);
 
-    TRACE("returning %p\n", This);
-    *ppOut = (IEnumGUID*)This;
+    *ppOut = &This->IEnumGUID_iface;
+    TRACE("returning %p\n", *ppOut);
     return S_OK;
 }
 
@@ -429,16 +445,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)
@@ -453,13 +470,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);
@@ -471,7 +488,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);
@@ -509,7 +526,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)
@@ -520,11 +537,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
 };
@@ -533,29 +550,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);
 
@@ -588,8 +605,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);
 
@@ -606,12 +623,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,
 };
@@ -624,8 +640,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;
@@ -633,7 +649,7 @@ static HRESULT Compartment_Constructor(CompartmentValue *valueData, ITfCompartme
 
     list_init(&This->CompartmentEventSink);
 
-    TRACE("returning %p\n", This);
-    *ppOut = (ITfCompartment*)This;
+    *ppOut = &This->ITfCompartment_iface;
+    TRACE("returning %p\n", *ppOut);
     return S_OK;
 }
index d9cd142..8d03749 100644 (file)
@@ -34,15 +34,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;
 
@@ -75,7 +75,7 @@ typedef struct tagEditCookie {
 } EditCookie;
 
 typedef struct tagTextStoreACPSink {
-    const ITextStoreACPSinkVtbl *TextStoreACPSinkVtbl;
+    ITextStoreACPSink ITextStoreACPSink_iface;
     /* const ITextStoreACPServicesVtbl *TextStoreACPServicesVtbl; */
     LONG refCount;
 
@@ -85,19 +85,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)
@@ -168,20 +178,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))
     {
@@ -189,7 +199,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)
@@ -204,13 +214,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);
@@ -226,8 +236,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);
@@ -277,7 +287,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;
 }
@@ -286,7 +296,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;
@@ -345,8 +355,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;
 
@@ -383,7 +393,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);
 
@@ -405,7 +415,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);
@@ -436,7 +446,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;
 }
@@ -444,7 +454,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;
 }
@@ -452,7 +462,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)
@@ -477,7 +487,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;
 }
@@ -485,7 +495,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;
 }
@@ -494,7 +504,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;
 }
@@ -502,7 +512,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;
 }
@@ -510,7 +520,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)
@@ -528,17 +538,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,
@@ -556,22 +565,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);
 }
 
 /*****************************************************
@@ -580,8 +589,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)
@@ -612,8 +621,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);
 
@@ -630,14 +639,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
 };
 
 /*****************************************************
@@ -645,27 +653,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;
@@ -692,7 +700,7 @@ static HRESULT WINAPI InsertAtSelection_InsertTextAtSelection(
 
     hr = ITextStoreACP_InsertTextAtSelection(This->pITextStoreACP, dwFlags, pchText, cch, &acpStart, &acpEnd, &change);
     if (SUCCEEDED(hr))
-        Range_Constructor((ITfContext*)This, This->pITextStoreACP, cookie->lockType, change.acpStart, change.acpNewEnd, ppRange);
+        Range_Constructor(&This->ITfContext_iface, This->pITextStoreACP, cookie->lockType, change.acpStart, change.acpNewEnd, ppRange);
 
     return hr;
 }
@@ -701,17 +709,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,
 };
@@ -721,26 +728,26 @@ static const ITfInsertAtSelectionVtbl Context_InsertAtSelectionVtbl =
  *****************************************************/
 static HRESULT WINAPI SourceSingle_QueryInterface(ITfSourceSingle *iface, REFIID iid, LPVOID *ppvOut)
 {
-    Context *This = impl_from_ITfSourceSingleVtbl(iface);
-    return Context_QueryInterface((ITfContext *)This, iid, *ppvOut);
+    Context *This = impl_from_ITfSourceSingle(iface);
+    return ITfContext_QueryInterface(&This->ITfContext_iface, iid, ppvOut);
 }
 
 static ULONG WINAPI SourceSingle_AddRef(ITfSourceSingle *iface)
 {
-    Context *This = impl_from_ITfSourceSingleVtbl(iface);
-    return Context_AddRef((ITfContext *)This);
+    Context *This = impl_from_ITfSourceSingle(iface);
+    return ITfContext_AddRef(&This->ITfContext_iface);
 }
 
 static ULONG WINAPI SourceSingle_Release(ITfSourceSingle *iface)
 {
-    Context *This = impl_from_ITfSourceSingleVtbl(iface);
-    return Context_Release((ITfContext *)This);
+    Context *This = impl_from_ITfSourceSingle(iface);
+    return ITfContext_Release(&This->ITfContext_iface);
 }
 
 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;
 }
@@ -748,17 +755,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,
 };
@@ -781,16 +787,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;
@@ -816,15 +822,15 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfDocumentMgr
     list_init(&This->pTextEditSink);
     list_init(&This->pTextLayoutSink);
 
-    *ppOut = (ITfContext*)This;
-    TRACE("returning %p\n", This);
+    *ppOut = &This->ITfContext_iface;
+    TRACE("returning %p\n", *ppOut);
 
     return S_OK;
 }
 
 HRESULT Context_Initialize(ITfContext *iface, ITfDocumentMgr *manager)
 {
-    Context *This = (Context *)iface;
+    Context *This = impl_from_ITfContext(iface);
 
     if (This->pITextStoreACP)
     {
@@ -839,7 +845,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)
     {
@@ -864,12 +870,12 @@ 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))
     {
-        *ppvOut = This;
+        *ppvOut = &This->ITextStoreACPSink_iface;
     }
 
     if (*ppvOut)
@@ -884,13 +890,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);
@@ -906,14 +912,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;
 }
@@ -921,7 +927,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;
 }
@@ -929,7 +935,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);
@@ -957,7 +963,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;
 }
@@ -965,7 +971,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;
@@ -1033,24 +1039,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,
@@ -1069,12 +1074,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;
+    TRACE("returning %p\n", *ppOut);
     return S_OK;
 }
index 0a0f32d..4c3e1aa 100644 (file)
@@ -46,7 +46,7 @@ static HRESULT WINAPI DisplayAttributeMgr_QueryInterface(ITfDisplayAttributeMgr
 
     if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfDisplayAttributeMgr))
     {
-        *ppvOut = This;
+        *ppvOut = &This->ITfDisplayAttributeMgr_iface;
     }
 
     if (*ppvOut)
@@ -104,12 +104,11 @@ static HRESULT WINAPI DisplayAttributeMgr_GetDisplayAttributeInfo(ITfDisplayAttr
     return E_NOTIMPL;
 }
 
-static const ITfDisplayAttributeMgrVtbl DisplayAttributeMgr_DisplayAttributeMgrVtbl =
+static const ITfDisplayAttributeMgrVtbl DisplayAttributeMgrVtbl =
 {
     DisplayAttributeMgr_QueryInterface,
     DisplayAttributeMgr_AddRef,
     DisplayAttributeMgr_Release,
-
     DisplayAttributeMgr_OnUpdateInfo,
     DisplayAttributeMgr_EnumDisplayAttributeInfo,
     DisplayAttributeMgr_GetDisplayAttributeInfo
@@ -125,10 +124,10 @@ HRESULT DisplayAttributeMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
     if (This == NULL)
         return E_OUTOFMEMORY;
 
-    This->ITfDisplayAttributeMgr_iface.lpVtbl = &DisplayAttributeMgr_DisplayAttributeMgrVtbl;
+    This->ITfDisplayAttributeMgr_iface.lpVtbl = &DisplayAttributeMgrVtbl;
     This->refCount = 1;
 
-    TRACE("returning %p\n", This);
-    *ppOut = (IUnknown *)This;
+    *ppOut = (IUnknown *)&This->ITfDisplayAttributeMgr_iface;
+    TRACE("returning %p\n", *ppOut);
     return S_OK;
 }
index 9033a2d..9ab0675 100644 (file)
@@ -80,7 +80,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))
     {
@@ -163,19 +163,17 @@ static HRESULT WINAPI DocumentMgr_Pop(ITfDocumentMgr *iface, DWORD dwFlags)
 
     if (dwFlags == TF_POPF_ALL)
     {
-        if (This->contextStack[0])
-        {
-            ITfThreadMgrEventSink_OnPopContext(This->ThreadMgrSink,This->contextStack[0]);
-            Context_Uninitialize(This->contextStack[0]);
-            ITfContext_Release(This->contextStack[0]);
-        }
-        if (This->contextStack[1])
-        {
-            ITfThreadMgrEventSink_OnPopContext(This->ThreadMgrSink,This->contextStack[1]);
-            Context_Uninitialize(This->contextStack[1]);
-            ITfContext_Release(This->contextStack[1]);
-        }
-        This->contextStack[0] = This->contextStack[1] = NULL;
+        int i;
+
+        for (i = 0; i < sizeof(This->contextStack)/sizeof(This->contextStack[0]); i++)
+            if (This->contextStack[i])
+            {
+                ITfThreadMgrEventSink_OnPopContext(This->ThreadMgrSink, This->contextStack[i]);
+                Context_Uninitialize(This->contextStack[i]);
+                ITfContext_Release(This->contextStack[i]);
+                This->contextStack[i] = NULL;
+            }
+
         ITfThreadMgrEventSink_OnUninitDocumentMgr(This->ThreadMgrSink, iface);
         return S_OK;
     }
@@ -242,12 +240,11 @@ static HRESULT WINAPI DocumentMgr_EnumContexts(ITfDocumentMgr *iface, IEnumTfCon
     return EnumTfContext_Constructor(This, ppEnum);
 }
 
-static const ITfDocumentMgrVtbl DocumentMgr_DocumentMgrVtbl =
+static const ITfDocumentMgrVtbl DocumentMgrVtbl =
 {
     DocumentMgr_QueryInterface,
     DocumentMgr_AddRef,
     DocumentMgr_Release,
-
     DocumentMgr_CreateContext,
     DocumentMgr_Push,
     DocumentMgr_Pop,
@@ -256,23 +253,22 @@ static const ITfDocumentMgrVtbl DocumentMgr_DocumentMgrVtbl =
     DocumentMgr_EnumContexts
 };
 
-
-static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut)
+static HRESULT WINAPI DocumentMgrSource_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)
+static ULONG WINAPI DocumentMgrSource_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)
+static ULONG WINAPI DocumentMgrSource_Release(ITfSource *iface)
 {
     DocumentMgr *This = impl_from_ITfSource(iface);
-    return DocumentMgr_Release(&This->ITfDocumentMgr_iface);
+    return ITfDocumentMgr_Release(&This->ITfDocumentMgr_iface);
 }
 
 /*****************************************************
@@ -293,12 +289,11 @@ static HRESULT WINAPI DocumentMgrSource_UnadviseSink(ITfSource *iface, DWORD pdw
     return E_NOTIMPL;
 }
 
-static const ITfSourceVtbl DocumentMgr_SourceVtbl =
+static const ITfSourceVtbl DocumentMgrSourceVtbl =
 {
-    Source_QueryInterface,
-    Source_AddRef,
-    Source_Release,
-
+    DocumentMgrSource_QueryInterface,
+    DocumentMgrSource_AddRef,
+    DocumentMgrSource_Release,
     DocumentMgrSource_AdviseSink,
     DocumentMgrSource_UnadviseSink,
 };
@@ -311,15 +306,15 @@ HRESULT DocumentMgr_Constructor(ITfThreadMgrEventSink *ThreadMgrSink, ITfDocumen
     if (This == NULL)
         return E_OUTOFMEMORY;
 
-    This->ITfDocumentMgr_iface.lpVtbl = &DocumentMgr_DocumentMgrVtbl;
-    This->ITfSource_iface.lpVtbl = &DocumentMgr_SourceVtbl;
+    This->ITfDocumentMgr_iface.lpVtbl = &DocumentMgrVtbl;
+    This->ITfSource_iface.lpVtbl = &DocumentMgrSourceVtbl;
     This->refCount = 1;
     This->ThreadMgrSink = ThreadMgrSink;
 
-    CompartmentMgr_Constructor((IUnknown*)This, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr);
+    CompartmentMgr_Constructor((IUnknown*)&This->ITfDocumentMgr_iface, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr);
 
-    TRACE("returning %p\n", This);
     *ppOut = &This->ITfDocumentMgr_iface;
+    TRACE("returning %p\n", *ppOut);
     return S_OK;
 }
 
@@ -339,7 +334,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)
@@ -457,7 +452,7 @@ static HRESULT EnumTfContext_Constructor(DocumentMgr *mgr, IEnumTfContexts **ppO
     This->refCount = 1;
     This->docmgr = mgr;
 
-    TRACE("returning %p\n", This);
     *ppOut = &This->IEnumTfContexts_iface;
+    TRACE("returning %p\n", *ppOut);
     return S_OK;
 }
index 91c9b74..7d22540 100644 (file)
@@ -40,8 +40,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; */
@@ -53,7 +53,7 @@ typedef struct tagInputProcessorProfiles {
 } InputProcessorProfiles;
 
 typedef struct tagProfilesEnumGuid {
-    const IEnumGUIDVtbl *Vtbl;
+    IEnumGUID IEnumGUID_iface;
     LONG refCount;
 
     HKEY key;
@@ -61,7 +61,7 @@ typedef struct tagProfilesEnumGuid {
 } ProfilesEnumGuid;
 
 typedef struct tagEnumTfLanguageProfiles {
-    const IEnumTfLanguageProfilesVtbl *Vtbl;
+    IEnumTfLanguageProfiles IEnumTfLanguageProfiles_iface;
     LONG refCount;
 
     HKEY    tipkey;
@@ -78,9 +78,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)
@@ -136,16 +151,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)
@@ -160,13 +175,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);
@@ -181,7 +196,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];
@@ -203,9 +218,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));
 
@@ -224,6 +239,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];
@@ -235,8 +251,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);
@@ -278,7 +292,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;
 }
@@ -286,7 +300,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);
 }
@@ -295,12 +309,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);
 
@@ -336,13 +350,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 };
@@ -386,10 +400,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));
 
@@ -422,8 +436,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);
 
@@ -447,7 +461,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;
 }
@@ -455,7 +469,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)
@@ -469,8 +483,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);
@@ -491,7 +505,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;
@@ -503,7 +517,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);
 }
@@ -512,13 +526,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);
@@ -542,13 +556,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)
@@ -589,13 +603,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);
@@ -619,18 +633,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,
@@ -656,27 +668,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);
 
@@ -709,8 +721,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);
 
@@ -727,12 +739,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,
 };
@@ -747,15 +758,15 @@ 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();
 
     list_init(&This->LanguageProfileNotifySink);
 
-    TRACE("returning %p\n", This);
-    *ppOut = (IUnknown *)This;
+    *ppOut = (IUnknown *)&This->ITfInputProcessorProfiles_iface;
+    TRACE("returning %p\n", *ppOut);
     return S_OK;
 }
 
@@ -771,12 +782,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)
@@ -791,13 +802,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);
@@ -812,7 +823,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);
@@ -844,7 +855,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;
@@ -853,7 +864,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;
@@ -862,7 +873,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);
@@ -872,17 +883,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,
@@ -897,7 +908,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,
@@ -907,8 +918,8 @@ static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut)
         return E_FAIL;
     }
 
-    TRACE("returning %p\n", This);
-    *ppOut = (IEnumGUID*)This;
+    *ppOut = &This->IEnumGUID_iface;
+    TRACE("returning %p\n", *ppOut);
     return S_OK;
 }
 
@@ -927,12 +938,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)
@@ -947,13 +959,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);
@@ -1020,7 +1032,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);
@@ -1062,14 +1074,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)
@@ -1082,7 +1094,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);
@@ -1109,11 +1121,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,
@@ -1129,7 +1141,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;
 
@@ -1147,7 +1159,7 @@ static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguage
         return E_FAIL;
     }
 
-    TRACE("returning %p\n", This);
-    *ppOut = (IEnumTfLanguageProfiles*)This;
+    *ppOut = &This->IEnumTfLanguageProfiles_iface;
+    TRACE("returning %p\n", *ppOut);
     return S_OK;
 }
index a18be8d..6b54ea9 100644 (file)
@@ -46,7 +46,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)
@@ -182,7 +182,7 @@ HRESULT LangBarMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
     This->ITfLangBarMgr_iface.lpVtbl = &LangBarMgr_LangBarMgrVtbl;
     This->refCount = 1;
 
-    TRACE("returning %p\n", This);
-    *ppOut = (IUnknown *)This;
+    *ppOut = (IUnknown *)&This->ITfLangBarMgr_iface;
+    TRACE("returning %p\n", *ppOut);
     return S_OK;
 }
index 805e154..66aadef 100644 (file)
@@ -18,6 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#pragma makedep register
+
 [
     threading(apartment),
     uuid(529a9e6b-6587-4f23-ab9e-9c7d683e3c50)
index 76926aa..e5a7fca 100644 (file)
@@ -52,7 +52,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)
@@ -325,7 +325,7 @@ HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD l
     This->anchorEnd = anchorEnd;
 
     *ppOut = &This->ITfRange_iface;
-    TRACE("returning %p\n", This);
+    TRACE("returning %p\n", *ppOut);
 
     return S_OK;
 }
@@ -339,7 +339,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;
index 9858ef8..3b6611c 100644 (file)
@@ -57,22 +57,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;
@@ -96,7 +96,7 @@ typedef struct tagACLMulti {
 } ThreadMgr;
 
 typedef struct tagEnumTfDocumentMgr {
-    const IEnumTfDocumentMgrsVtbl *Vtbl;
+    IEnumTfDocumentMgrs IEnumTfDocumentMgrs_iface;
     LONG refCount;
 
     struct list *index;
@@ -105,35 +105,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 CONTAINING_RECORD(iface, ThreadMgr, ITfSourceSingle_iface);
+}
 
+static inline EnumTfDocumentMgr *impl_from_IEnumTfDocumentMgrs(IEnumTfDocumentMgrs *iface)
 {
-    return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,SourceSingleVtbl));
+    return CONTAINING_RECORD(iface, EnumTfDocumentMgr, IEnumTfDocumentMgrs_iface);
 }
 
 static void free_sink(ThreadMgrSink *sink)
@@ -223,28 +232,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))
     {
@@ -252,7 +261,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)
@@ -267,13 +276,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);
@@ -288,7 +297,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);
 
@@ -299,7 +308,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);
@@ -310,7 +319,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)
@@ -322,7 +331,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;
         }
@@ -333,10 +342,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;
 
@@ -345,7 +353,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))
     {
@@ -358,10 +366,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)
@@ -373,7 +380,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)
@@ -393,8 +400,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);
 
@@ -403,7 +410,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);
@@ -467,8 +474,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);
@@ -508,8 +515,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);
@@ -519,7 +527,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;
 }
@@ -527,7 +535,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;
 }
@@ -535,7 +543,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);
 
@@ -554,12 +562,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,
@@ -573,23 +580,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);
 }
 
 /*****************************************************
@@ -598,8 +604,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);
 
@@ -632,8 +638,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);
 
@@ -650,12 +656,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,
 };
@@ -666,26 +671,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;
 
@@ -725,7 +730,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);
@@ -757,7 +762,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;
@@ -772,7 +777,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;
 }
@@ -780,7 +785,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;
 }
@@ -788,7 +793,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;
 }
@@ -796,7 +801,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;
 }
@@ -804,7 +809,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;
 }
@@ -812,7 +817,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);
@@ -838,7 +843,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;
 
@@ -881,7 +886,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);
@@ -910,7 +915,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;
 }
@@ -918,7 +923,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;
 }
@@ -926,17 +931,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,
@@ -959,20 +963,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,
@@ -1015,12 +1019,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,
@@ -1033,29 +1036,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));
 
@@ -1066,12 +1069,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
 };
 
@@ -1081,19 +1083,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);
 }
 
 
@@ -1183,12 +1185,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,
@@ -1201,26 +1202,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;
 }
@@ -1228,19 +1229,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)
@@ -1253,8 +1253,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;
     }
 
@@ -1262,13 +1262,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);
 
@@ -1286,7 +1286,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;
 }
 
@@ -1301,12 +1301,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)
@@ -1321,13 +1321,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);
@@ -1339,7 +1339,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);
@@ -1370,8 +1370,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);
@@ -1380,7 +1381,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;
@@ -1389,7 +1390,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);
@@ -1399,17 +1400,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,
@@ -1424,7 +1425,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);
@@ -1434,9 +1435,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)
     {
index 9104224..956051f 100644 (file)
@@ -16,7 +16,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-1 WINE_REGISTRY "msctf.rgs"
+1 WINE_REGISTRY msctf_classes.rgs
 
 #define WINE_FILEDESCRIPTION_STR "Wine Msctf"
 #define WINE_FILENAME_STR "msctf.dll"
index 9d32813..f523668 100644 (file)
@@ -113,7 +113,7 @@ reactos/dll/win32/msadp32.acm         # Synced to Wine-1.7.17
 reactos/dll/win32/mscat32             # Synced to Wine-1.7.1
 reactos/dll/win32/mscms               # Synced to Wine-1.7.17
 reactos/dll/win32/mscoree             # Synced to Wine-1.5.4
-reactos/dll/win32/msctf               # Synced to Wine-1.7.1
+reactos/dll/win32/msctf               # Synced to Wine-1.7.17
 reactos/dll/win32/msftedit            # Synced to Wine-1.7.1
 reactos/dll/win32/msg711.acm          # Synced to Wine-1.7.1
 reactos/dll/win32/msgsm32.acm         # Synced to Wine-1.7.1