msctf: COM interface cleanup.

This commit is contained in:
Nikolay Sivov 2013-11-17 12:21:51 +04:00 committed by Alexandre Julliard
parent 70bb23a9ac
commit fc245339b0
8 changed files with 402 additions and 368 deletions

View File

@ -51,7 +51,7 @@ typedef struct tagCompartmentValue {
} CompartmentValue; } CompartmentValue;
typedef struct tagCompartmentMgr { typedef struct tagCompartmentMgr {
const ITfCompartmentMgrVtbl *CompartmentMgrVtbl; ITfCompartmentMgr ITfCompartmentMgr_iface;
LONG refCount; LONG refCount;
IUnknown *pUnkOuter; IUnknown *pUnkOuter;
@ -60,7 +60,7 @@ typedef struct tagCompartmentMgr {
} CompartmentMgr; } CompartmentMgr;
typedef struct tagCompartmentEnumGuid { typedef struct tagCompartmentEnumGuid {
const IEnumGUIDVtbl *Vtbl; IEnumGUID IEnumGUID_iface;
LONG refCount; LONG refCount;
struct list *values; struct list *values;
@ -77,8 +77,8 @@ typedef struct tagCompartmentSink {
} CompartmentSink; } CompartmentSink;
typedef struct tagCompartment { typedef struct tagCompartment {
const ITfCompartmentVtbl *Vtbl; ITfCompartment ITfCompartment_iface;
const ITfSourceVtbl *SourceVtbl; ITfSource ITfSource_iface;
LONG refCount; LONG refCount;
/* Only VT_I4, VT_UNKNOWN and VT_BSTR data types are allowed */ /* Only VT_I4, VT_UNKNOWN and VT_BSTR data types are allowed */
@ -90,14 +90,29 @@ typedef struct tagCompartment {
static HRESULT CompartmentEnumGuid_Constructor(struct list* values, IEnumGUID **ppOut); static HRESULT CompartmentEnumGuid_Constructor(struct list* values, IEnumGUID **ppOut);
static HRESULT Compartment_Constructor(CompartmentValue *value, ITfCompartment **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) HRESULT CompartmentMgr_Destructor(ITfCompartmentMgr *iface)
{ {
CompartmentMgr *This = (CompartmentMgr *)iface; CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface);
struct list *cursor, *cursor2; struct list *cursor, *cursor2;
LIST_FOR_EACH_SAFE(cursor, cursor2, &This->values) LIST_FOR_EACH_SAFE(cursor, cursor2, &This->values)
@ -117,7 +132,7 @@ HRESULT CompartmentMgr_Destructor(ITfCompartmentMgr *iface)
*****************************************************/ *****************************************************/
static HRESULT WINAPI CompartmentMgr_QueryInterface(ITfCompartmentMgr *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI CompartmentMgr_QueryInterface(ITfCompartmentMgr *iface, REFIID iid, LPVOID *ppvOut)
{ {
CompartmentMgr *This = (CompartmentMgr *)iface; CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface);
if (This->pUnkOuter) if (This->pUnkOuter)
return IUnknown_QueryInterface(This->pUnkOuter, iid, *ppvOut); return IUnknown_QueryInterface(This->pUnkOuter, iid, *ppvOut);
else else
@ -142,7 +157,7 @@ static HRESULT WINAPI CompartmentMgr_QueryInterface(ITfCompartmentMgr *iface, RE
static ULONG WINAPI CompartmentMgr_AddRef(ITfCompartmentMgr *iface) static ULONG WINAPI CompartmentMgr_AddRef(ITfCompartmentMgr *iface)
{ {
CompartmentMgr *This = (CompartmentMgr *)iface; CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface);
if (This->pUnkOuter) if (This->pUnkOuter)
return IUnknown_AddRef(This->pUnkOuter); return IUnknown_AddRef(This->pUnkOuter);
else else
@ -151,7 +166,7 @@ static ULONG WINAPI CompartmentMgr_AddRef(ITfCompartmentMgr *iface)
static ULONG WINAPI CompartmentMgr_Release(ITfCompartmentMgr *iface) static ULONG WINAPI CompartmentMgr_Release(ITfCompartmentMgr *iface)
{ {
CompartmentMgr *This = (CompartmentMgr *)iface; CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface);
if (This->pUnkOuter) if (This->pUnkOuter)
return IUnknown_Release(This->pUnkOuter); return IUnknown_Release(This->pUnkOuter);
else else
@ -168,7 +183,7 @@ static ULONG WINAPI CompartmentMgr_Release(ITfCompartmentMgr *iface)
static HRESULT WINAPI CompartmentMgr_GetCompartment(ITfCompartmentMgr *iface, static HRESULT WINAPI CompartmentMgr_GetCompartment(ITfCompartmentMgr *iface,
REFGUID rguid, ITfCompartment **ppcomp) REFGUID rguid, ITfCompartment **ppcomp)
{ {
CompartmentMgr *This = (CompartmentMgr *)iface; CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface);
CompartmentValue* value; CompartmentValue* value;
struct list *cursor; struct list *cursor;
HRESULT hr; HRESULT hr;
@ -207,8 +222,9 @@ static HRESULT WINAPI CompartmentMgr_GetCompartment(ITfCompartmentMgr *iface,
static HRESULT WINAPI CompartmentMgr_ClearCompartment(ITfCompartmentMgr *iface, static HRESULT WINAPI CompartmentMgr_ClearCompartment(ITfCompartmentMgr *iface,
TfClientId tid, REFGUID rguid) TfClientId tid, REFGUID rguid)
{ {
CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface);
struct list *cursor; struct list *cursor;
CompartmentMgr *This = (CompartmentMgr *)iface;
TRACE("(%p) %i %s\n",This,tid,debugstr_guid(rguid)); TRACE("(%p) %i %s\n",This,tid,debugstr_guid(rguid));
LIST_FOR_EACH(cursor, &This->values) LIST_FOR_EACH(cursor, &This->values)
@ -231,19 +247,19 @@ static HRESULT WINAPI CompartmentMgr_ClearCompartment(ITfCompartmentMgr *iface,
static HRESULT WINAPI CompartmentMgr_EnumCompartments(ITfCompartmentMgr *iface, static HRESULT WINAPI CompartmentMgr_EnumCompartments(ITfCompartmentMgr *iface,
IEnumGUID **ppEnum) IEnumGUID **ppEnum)
{ {
CompartmentMgr *This = (CompartmentMgr *)iface; CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface);
TRACE("(%p) %p\n",This,ppEnum); TRACE("(%p) %p\n",This,ppEnum);
if (!ppEnum) if (!ppEnum)
return E_INVALIDARG; return E_INVALIDARG;
return CompartmentEnumGuid_Constructor(&This->values, ppEnum); return CompartmentEnumGuid_Constructor(&This->values, ppEnum);
} }
static const ITfCompartmentMgrVtbl CompartmentMgr_CompartmentMgrVtbl = static const ITfCompartmentMgrVtbl CompartmentMgrVtbl =
{ {
CompartmentMgr_QueryInterface, CompartmentMgr_QueryInterface,
CompartmentMgr_AddRef, CompartmentMgr_AddRef,
CompartmentMgr_Release, CompartmentMgr_Release,
CompartmentMgr_GetCompartment, CompartmentMgr_GetCompartment,
CompartmentMgr_ClearCompartment, CompartmentMgr_ClearCompartment,
CompartmentMgr_EnumCompartments CompartmentMgr_EnumCompartments
@ -263,7 +279,7 @@ HRESULT CompartmentMgr_Constructor(IUnknown *pUnkOuter, REFIID riid, IUnknown **
if (This == NULL) if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->CompartmentMgrVtbl = &CompartmentMgr_CompartmentMgrVtbl; This->ITfCompartmentMgr_iface.lpVtbl = &CompartmentMgrVtbl;
This->pUnkOuter = pUnkOuter; This->pUnkOuter = pUnkOuter;
list_init(&This->values); list_init(&This->values);
@ -276,7 +292,7 @@ HRESULT CompartmentMgr_Constructor(IUnknown *pUnkOuter, REFIID riid, IUnknown **
else else
{ {
HRESULT hr; HRESULT hr;
hr = IUnknown_QueryInterface((IUnknown*)This, riid, (LPVOID*)ppOut); hr = ITfCompartmentMgr_QueryInterface(&This->ITfCompartmentMgr_iface, riid, (void**)ppOut);
if (FAILED(hr)) if (FAILED(hr))
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
return hr; return hr;
@ -294,12 +310,12 @@ static void CompartmentEnumGuid_Destructor(CompartmentEnumGuid *This)
static HRESULT WINAPI CompartmentEnumGuid_QueryInterface(IEnumGUID *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI CompartmentEnumGuid_QueryInterface(IEnumGUID *iface, REFIID iid, LPVOID *ppvOut)
{ {
CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; CompartmentEnumGuid *This = impl_from_IEnumGUID(iface);
*ppvOut = NULL; *ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumGUID)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumGUID))
{ {
*ppvOut = This; *ppvOut = &This->IEnumGUID_iface;
} }
if (*ppvOut) if (*ppvOut)
@ -314,13 +330,13 @@ static HRESULT WINAPI CompartmentEnumGuid_QueryInterface(IEnumGUID *iface, REFII
static ULONG WINAPI CompartmentEnumGuid_AddRef(IEnumGUID *iface) static ULONG WINAPI CompartmentEnumGuid_AddRef(IEnumGUID *iface)
{ {
CompartmentEnumGuid *This = (CompartmentEnumGuid*)iface; CompartmentEnumGuid *This = impl_from_IEnumGUID(iface);
return InterlockedIncrement(&This->refCount); return InterlockedIncrement(&This->refCount);
} }
static ULONG WINAPI CompartmentEnumGuid_Release(IEnumGUID *iface) static ULONG WINAPI CompartmentEnumGuid_Release(IEnumGUID *iface)
{ {
CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; CompartmentEnumGuid *This = impl_from_IEnumGUID(iface);
ULONG ret; ULONG ret;
ret = InterlockedDecrement(&This->refCount); ret = InterlockedDecrement(&This->refCount);
@ -332,10 +348,10 @@ static ULONG WINAPI CompartmentEnumGuid_Release(IEnumGUID *iface)
/***************************************************** /*****************************************************
* IEnumGuid functions * IEnumGuid functions
*****************************************************/ *****************************************************/
static HRESULT WINAPI CompartmentEnumGuid_Next( LPENUMGUID iface, static HRESULT WINAPI CompartmentEnumGuid_Next(IEnumGUID *iface,
ULONG celt, GUID *rgelt, ULONG *pceltFetched) ULONG celt, GUID *rgelt, ULONG *pceltFetched)
{ {
CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; CompartmentEnumGuid *This = impl_from_IEnumGUID(iface);
ULONG fetched = 0; ULONG fetched = 0;
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
@ -359,27 +375,27 @@ static HRESULT WINAPI CompartmentEnumGuid_Next( LPENUMGUID iface,
return fetched == celt ? S_OK : S_FALSE; 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); TRACE("(%p)\n",This);
This->cursor = list_next(This->values,This->cursor); This->cursor = list_next(This->values,This->cursor);
return S_OK; 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); TRACE("(%p)\n",This);
This->cursor = list_head(This->values); This->cursor = list_head(This->values);
return S_OK; return S_OK;
} }
static HRESULT WINAPI CompartmentEnumGuid_Clone( LPENUMGUID iface, static HRESULT WINAPI CompartmentEnumGuid_Clone(IEnumGUID *iface,
IEnumGUID **ppenum) IEnumGUID **ppenum)
{ {
CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; CompartmentEnumGuid *This = impl_from_IEnumGUID(iface);
HRESULT res; HRESULT res;
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
@ -389,17 +405,17 @@ static HRESULT WINAPI CompartmentEnumGuid_Clone( LPENUMGUID iface,
res = CompartmentEnumGuid_Constructor(This->values, ppenum); res = CompartmentEnumGuid_Constructor(This->values, ppenum);
if (SUCCEEDED(res)) if (SUCCEEDED(res))
{ {
CompartmentEnumGuid *new_This = (CompartmentEnumGuid *)*ppenum; CompartmentEnumGuid *new_This = impl_from_IEnumGUID(*ppenum);
new_This->cursor = This->cursor; new_This->cursor = This->cursor;
} }
return res; return res;
} }
static const IEnumGUIDVtbl IEnumGUID_Vtbl ={ static const IEnumGUIDVtbl EnumGUIDVtbl =
{
CompartmentEnumGuid_QueryInterface, CompartmentEnumGuid_QueryInterface,
CompartmentEnumGuid_AddRef, CompartmentEnumGuid_AddRef,
CompartmentEnumGuid_Release, CompartmentEnumGuid_Release,
CompartmentEnumGuid_Next, CompartmentEnumGuid_Next,
CompartmentEnumGuid_Skip, CompartmentEnumGuid_Skip,
CompartmentEnumGuid_Reset, CompartmentEnumGuid_Reset,
@ -414,7 +430,7 @@ static HRESULT CompartmentEnumGuid_Constructor(struct list *values, IEnumGUID **
if (This == NULL) if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->Vtbl= &IEnumGUID_Vtbl; This->IEnumGUID_iface.lpVtbl= &EnumGUIDVtbl;
This->refCount = 1; This->refCount = 1;
This->values = values; This->values = values;
@ -450,16 +466,17 @@ static void Compartment_Destructor(Compartment *This)
static HRESULT WINAPI Compartment_QueryInterface(ITfCompartment *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI Compartment_QueryInterface(ITfCompartment *iface, REFIID iid, LPVOID *ppvOut)
{ {
Compartment *This = (Compartment *)iface; Compartment *This = impl_from_ITfCompartment(iface);
*ppvOut = NULL; *ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfCompartment)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfCompartment))
{ {
*ppvOut = This; *ppvOut = &This->ITfCompartment_iface;
} }
else if (IsEqualIID(iid, &IID_ITfSource)) else if (IsEqualIID(iid, &IID_ITfSource))
{ {
*ppvOut = &This->SourceVtbl; *ppvOut = &This->ITfSource_iface;
} }
if (*ppvOut) if (*ppvOut)
@ -474,13 +491,13 @@ static HRESULT WINAPI Compartment_QueryInterface(ITfCompartment *iface, REFIID i
static ULONG WINAPI Compartment_AddRef(ITfCompartment *iface) static ULONG WINAPI Compartment_AddRef(ITfCompartment *iface)
{ {
Compartment *This = (Compartment*)iface; Compartment *This = impl_from_ITfCompartment(iface);
return InterlockedIncrement(&This->refCount); return InterlockedIncrement(&This->refCount);
} }
static ULONG WINAPI Compartment_Release(ITfCompartment *iface) static ULONG WINAPI Compartment_Release(ITfCompartment *iface)
{ {
Compartment *This = (Compartment *)iface; Compartment *This = impl_from_ITfCompartment(iface);
ULONG ret; ULONG ret;
ret = InterlockedDecrement(&This->refCount); ret = InterlockedDecrement(&This->refCount);
@ -492,7 +509,7 @@ static ULONG WINAPI Compartment_Release(ITfCompartment *iface)
static HRESULT WINAPI Compartment_SetValue(ITfCompartment *iface, static HRESULT WINAPI Compartment_SetValue(ITfCompartment *iface,
TfClientId tid, const VARIANT *pvarValue) TfClientId tid, const VARIANT *pvarValue)
{ {
Compartment *This = (Compartment *)iface; Compartment *This = impl_from_ITfCompartment(iface);
struct list *cursor; struct list *cursor;
TRACE("(%p) %i %p\n",This,tid,pvarValue); TRACE("(%p) %i %p\n",This,tid,pvarValue);
@ -530,7 +547,7 @@ static HRESULT WINAPI Compartment_SetValue(ITfCompartment *iface,
static HRESULT WINAPI Compartment_GetValue(ITfCompartment *iface, static HRESULT WINAPI Compartment_GetValue(ITfCompartment *iface,
VARIANT *pvarValue) VARIANT *pvarValue)
{ {
Compartment *This = (Compartment *)iface; Compartment *This = impl_from_ITfCompartment(iface);
TRACE("(%p) %p\n",This, pvarValue); TRACE("(%p) %p\n",This, pvarValue);
if (!pvarValue) if (!pvarValue)
@ -541,11 +558,11 @@ static HRESULT WINAPI Compartment_GetValue(ITfCompartment *iface,
return VariantCopy(pvarValue,&This->variant); return VariantCopy(pvarValue,&This->variant);
} }
static const ITfCompartmentVtbl ITfCompartment_Vtbl ={ static const ITfCompartmentVtbl CompartmentVtbl =
{
Compartment_QueryInterface, Compartment_QueryInterface,
Compartment_AddRef, Compartment_AddRef,
Compartment_Release, Compartment_Release,
Compartment_SetValue, Compartment_SetValue,
Compartment_GetValue Compartment_GetValue
}; };
@ -554,29 +571,29 @@ static const ITfCompartmentVtbl ITfCompartment_Vtbl ={
* ITfSource functions * 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); Compartment *This = impl_from_ITfSource(iface);
return Compartment_QueryInterface((ITfCompartment *)This, iid, *ppvOut); 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); Compartment *This = impl_from_ITfSource(iface);
return Compartment_AddRef((ITfCompartment*)This); 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); Compartment *This = impl_from_ITfSource(iface);
return Compartment_Release((ITfCompartment *)This); return ITfCompartment_Release(&This->ITfCompartment_iface);
} }
static HRESULT WINAPI CompartmentSource_AdviseSink(ITfSource *iface, static HRESULT WINAPI CompartmentSource_AdviseSink(ITfSource *iface,
REFIID riid, IUnknown *punk, DWORD *pdwCookie) REFIID riid, IUnknown *punk, DWORD *pdwCookie)
{ {
Compartment *This = impl_from_ITfSource(iface);
CompartmentSink *cs; CompartmentSink *cs;
Compartment *This = impl_from_ITfSourceVtbl(iface);
TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
@ -609,8 +626,8 @@ static HRESULT WINAPI CompartmentSource_AdviseSink(ITfSource *iface,
static HRESULT WINAPI CompartmentSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) static HRESULT WINAPI CompartmentSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
{ {
Compartment *This = impl_from_ITfSource(iface);
CompartmentSink *sink; CompartmentSink *sink;
Compartment *This = impl_from_ITfSourceVtbl(iface);
TRACE("(%p) %x\n",This,pdwCookie); TRACE("(%p) %x\n",This,pdwCookie);
@ -627,12 +644,11 @@ static HRESULT WINAPI CompartmentSource_UnadviseSink(ITfSource *iface, DWORD pdw
return S_OK; return S_OK;
} }
static const ITfSourceVtbl Compartment_SourceVtbl = static const ITfSourceVtbl CompartmentSourceVtbl =
{ {
Source_QueryInterface, CompartmentSource_QueryInterface,
Source_AddRef, CompartmentSource_AddRef,
Source_Release, CompartmentSource_Release,
CompartmentSource_AdviseSink, CompartmentSource_AdviseSink,
CompartmentSource_UnadviseSink, CompartmentSource_UnadviseSink,
}; };
@ -645,8 +661,8 @@ static HRESULT Compartment_Constructor(CompartmentValue *valueData, ITfCompartme
if (This == NULL) if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->Vtbl= &ITfCompartment_Vtbl; This->ITfCompartment_iface.lpVtbl= &CompartmentVtbl;
This->SourceVtbl = &Compartment_SourceVtbl; This->ITfSource_iface.lpVtbl = &CompartmentSourceVtbl;
This->refCount = 1; This->refCount = 1;
This->valueData = valueData; This->valueData = valueData;

View File

@ -56,15 +56,15 @@ typedef struct tagContextSink {
} ContextSink; } ContextSink;
typedef struct tagContext { typedef struct tagContext {
const ITfContextVtbl *ContextVtbl; ITfContext ITfContext_iface;
const ITfSourceVtbl *SourceVtbl; ITfSource ITfSource_iface;
/* const ITfContextCompositionVtbl *ContextCompositionVtbl; */ /* const ITfContextCompositionVtbl *ContextCompositionVtbl; */
/* const ITfContextOwnerCompositionServicesVtbl *ContextOwnerCompositionServicesVtbl; */ /* const ITfContextOwnerCompositionServicesVtbl *ContextOwnerCompositionServicesVtbl; */
/* const ITfContextOwnerServicesVtbl *ContextOwnerServicesVtbl; */ /* const ITfContextOwnerServicesVtbl *ContextOwnerServicesVtbl; */
const ITfInsertAtSelectionVtbl *InsertAtSelectionVtbl; ITfInsertAtSelection ITfInsertAtSelection_iface;
/* const ITfMouseTrackerVtbl *MouseTrackerVtbl; */ /* const ITfMouseTrackerVtbl *MouseTrackerVtbl; */
/* const ITfQueryEmbeddedVtbl *QueryEmbeddedVtbl; */ /* const ITfQueryEmbeddedVtbl *QueryEmbeddedVtbl; */
const ITfSourceSingleVtbl *SourceSingleVtbl; ITfSourceSingle ITfSourceSingle_iface;
LONG refCount; LONG refCount;
BOOL connected; BOOL connected;
@ -97,7 +97,7 @@ typedef struct tagEditCookie {
} EditCookie; } EditCookie;
typedef struct tagTextStoreACPSink { typedef struct tagTextStoreACPSink {
const ITextStoreACPSinkVtbl *TextStoreACPSinkVtbl; ITextStoreACPSink ITextStoreACPSink_iface;
/* const ITextStoreACPServicesVtbl *TextStoreACPServicesVtbl; */ /* const ITextStoreACPServicesVtbl *TextStoreACPServicesVtbl; */
LONG refCount; LONG refCount;
@ -107,19 +107,29 @@ typedef struct tagTextStoreACPSink {
static HRESULT TextStoreACPSink_Constructor(ITextStoreACPSink **ppOut, Context *pContext); 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) static void free_sink(ContextSink *sink)
@ -190,20 +200,20 @@ static void Context_Destructor(Context *This)
static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVOID *ppvOut)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
*ppvOut = NULL; *ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfContext)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfContext))
{ {
*ppvOut = This; *ppvOut = &This->ITfContext_iface;
} }
else if (IsEqualIID(iid, &IID_ITfSource)) else if (IsEqualIID(iid, &IID_ITfSource))
{ {
*ppvOut = &This->SourceVtbl; *ppvOut = &This->ITfSource_iface;
} }
else if (IsEqualIID(iid, &IID_ITfInsertAtSelection)) else if (IsEqualIID(iid, &IID_ITfInsertAtSelection))
{ {
*ppvOut = &This->InsertAtSelectionVtbl; *ppvOut = &This->ITfInsertAtSelection_iface;
} }
else if (IsEqualIID(iid, &IID_ITfCompartmentMgr)) else if (IsEqualIID(iid, &IID_ITfCompartmentMgr))
{ {
@ -211,7 +221,7 @@ static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVO
} }
else if (IsEqualIID(iid, &IID_ITfSourceSingle)) else if (IsEqualIID(iid, &IID_ITfSourceSingle))
{ {
*ppvOut = &This->SourceSingleVtbl; *ppvOut = &This->ITfSourceSingle_iface;
} }
if (*ppvOut) if (*ppvOut)
@ -226,13 +236,13 @@ static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVO
static ULONG WINAPI Context_AddRef(ITfContext *iface) static ULONG WINAPI Context_AddRef(ITfContext *iface)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
return InterlockedIncrement(&This->refCount); return InterlockedIncrement(&This->refCount);
} }
static ULONG WINAPI Context_Release(ITfContext *iface) static ULONG WINAPI Context_Release(ITfContext *iface)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
ULONG ret; ULONG ret;
ret = InterlockedDecrement(&This->refCount); ret = InterlockedDecrement(&This->refCount);
@ -248,8 +258,8 @@ static HRESULT WINAPI Context_RequestEditSession (ITfContext *iface,
TfClientId tid, ITfEditSession *pes, DWORD dwFlags, TfClientId tid, ITfEditSession *pes, DWORD dwFlags,
HRESULT *phrSession) HRESULT *phrSession)
{ {
Context *This = impl_from_ITfContext(iface);
HRESULT hr; HRESULT hr;
Context *This = (Context *)iface;
DWORD dwLockFlags = 0x0; DWORD dwLockFlags = 0x0;
TRACE("(%p) %i %p %x %p\n",This, tid, pes, dwFlags, phrSession); TRACE("(%p) %i %p %x %p\n",This, tid, pes, dwFlags, phrSession);
@ -299,7 +309,7 @@ static HRESULT WINAPI Context_InWriteSession (ITfContext *iface,
TfClientId tid, TfClientId tid,
BOOL *pfWriteSession) BOOL *pfWriteSession)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -308,7 +318,7 @@ static HRESULT WINAPI Context_GetSelection (ITfContext *iface,
TfEditCookie ec, ULONG ulIndex, ULONG ulCount, TfEditCookie ec, ULONG ulIndex, ULONG ulCount,
TF_SELECTION *pSelection, ULONG *pcFetched) TF_SELECTION *pSelection, ULONG *pcFetched)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
EditCookie *cookie; EditCookie *cookie;
ULONG count, i; ULONG count, i;
ULONG totalFetched = 0; ULONG totalFetched = 0;
@ -367,8 +377,8 @@ static HRESULT WINAPI Context_GetSelection (ITfContext *iface,
static HRESULT WINAPI Context_SetSelection (ITfContext *iface, static HRESULT WINAPI Context_SetSelection (ITfContext *iface,
TfEditCookie ec, ULONG ulCount, const TF_SELECTION *pSelection) TfEditCookie ec, ULONG ulCount, const TF_SELECTION *pSelection)
{ {
Context *This = impl_from_ITfContext(iface);
TS_SELECTION_ACP *acp; TS_SELECTION_ACP *acp;
Context *This = (Context *)iface;
ULONG i; ULONG i;
HRESULT hr; HRESULT hr;
@ -405,7 +415,7 @@ static HRESULT WINAPI Context_SetSelection (ITfContext *iface,
static HRESULT WINAPI Context_GetStart (ITfContext *iface, static HRESULT WINAPI Context_GetStart (ITfContext *iface,
TfEditCookie ec, ITfRange **ppStart) TfEditCookie ec, ITfRange **ppStart)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
EditCookie *cookie; EditCookie *cookie;
TRACE("(%p) %i %p\n",This,ec,ppStart); TRACE("(%p) %i %p\n",This,ec,ppStart);
@ -427,7 +437,7 @@ static HRESULT WINAPI Context_GetStart (ITfContext *iface,
static HRESULT WINAPI Context_GetEnd (ITfContext *iface, static HRESULT WINAPI Context_GetEnd (ITfContext *iface,
TfEditCookie ec, ITfRange **ppEnd) TfEditCookie ec, ITfRange **ppEnd)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
EditCookie *cookie; EditCookie *cookie;
LONG end; LONG end;
TRACE("(%p) %i %p\n",This,ec,ppEnd); TRACE("(%p) %i %p\n",This,ec,ppEnd);
@ -458,7 +468,7 @@ static HRESULT WINAPI Context_GetEnd (ITfContext *iface,
static HRESULT WINAPI Context_GetActiveView (ITfContext *iface, static HRESULT WINAPI Context_GetActiveView (ITfContext *iface,
ITfContextView **ppView) ITfContextView **ppView)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -466,7 +476,7 @@ static HRESULT WINAPI Context_GetActiveView (ITfContext *iface,
static HRESULT WINAPI Context_EnumViews (ITfContext *iface, static HRESULT WINAPI Context_EnumViews (ITfContext *iface,
IEnumTfContextViews **ppEnum) IEnumTfContextViews **ppEnum)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -474,7 +484,7 @@ static HRESULT WINAPI Context_EnumViews (ITfContext *iface,
static HRESULT WINAPI Context_GetStatus (ITfContext *iface, static HRESULT WINAPI Context_GetStatus (ITfContext *iface,
TF_STATUS *pdcs) TF_STATUS *pdcs)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
TRACE("(%p) %p\n",This,pdcs); TRACE("(%p) %p\n",This,pdcs);
if (!This->connected) if (!This->connected)
@ -499,7 +509,7 @@ static HRESULT WINAPI Context_GetStatus (ITfContext *iface,
static HRESULT WINAPI Context_GetProperty (ITfContext *iface, static HRESULT WINAPI Context_GetProperty (ITfContext *iface,
REFGUID guidProp, ITfProperty **ppProp) REFGUID guidProp, ITfProperty **ppProp)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -507,7 +517,7 @@ static HRESULT WINAPI Context_GetProperty (ITfContext *iface,
static HRESULT WINAPI Context_GetAppProperty (ITfContext *iface, static HRESULT WINAPI Context_GetAppProperty (ITfContext *iface,
REFGUID guidProp, ITfReadOnlyProperty **ppProp) REFGUID guidProp, ITfReadOnlyProperty **ppProp)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -516,7 +526,7 @@ static HRESULT WINAPI Context_TrackProperties (ITfContext *iface,
const GUID **prgProp, ULONG cProp, const GUID **prgAppProp, const GUID **prgProp, ULONG cProp, const GUID **prgAppProp,
ULONG cAppProp, ITfReadOnlyProperty **ppProperty) ULONG cAppProp, ITfReadOnlyProperty **ppProperty)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -524,7 +534,7 @@ static HRESULT WINAPI Context_TrackProperties (ITfContext *iface,
static HRESULT WINAPI Context_EnumProperties (ITfContext *iface, static HRESULT WINAPI Context_EnumProperties (ITfContext *iface,
IEnumTfProperties **ppEnum) IEnumTfProperties **ppEnum)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -532,7 +542,7 @@ static HRESULT WINAPI Context_EnumProperties (ITfContext *iface,
static HRESULT WINAPI Context_GetDocumentMgr (ITfContext *iface, static HRESULT WINAPI Context_GetDocumentMgr (ITfContext *iface,
ITfDocumentMgr **ppDm) ITfDocumentMgr **ppDm)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
TRACE("(%p) %p\n",This,ppDm); TRACE("(%p) %p\n",This,ppDm);
if (!ppDm) if (!ppDm)
@ -550,17 +560,16 @@ static HRESULT WINAPI Context_GetDocumentMgr (ITfContext *iface,
static HRESULT WINAPI Context_CreateRangeBackup (ITfContext *iface, static HRESULT WINAPI Context_CreateRangeBackup (ITfContext *iface,
TfEditCookie ec, ITfRange *pRange, ITfRangeBackup **ppBackup) TfEditCookie ec, ITfRange *pRange, ITfRangeBackup **ppBackup)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static const ITfContextVtbl Context_ContextVtbl = static const ITfContextVtbl ContextVtbl =
{ {
Context_QueryInterface, Context_QueryInterface,
Context_AddRef, Context_AddRef,
Context_Release, Context_Release,
Context_RequestEditSession, Context_RequestEditSession,
Context_InWriteSession, Context_InWriteSession,
Context_GetSelection, Context_GetSelection,
@ -578,22 +587,22 @@ static const ITfContextVtbl Context_ContextVtbl =
Context_CreateRangeBackup 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); Context *This = impl_from_ITfSource(iface);
return Context_QueryInterface((ITfContext *)This, iid, *ppvOut); 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); Context *This = impl_from_ITfSource(iface);
return Context_AddRef((ITfContext *)This); 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); Context *This = impl_from_ITfSource(iface);
return Context_Release((ITfContext *)This); return ITfContext_Release(&This->ITfContext_iface);
} }
/***************************************************** /*****************************************************
@ -602,8 +611,8 @@ static ULONG WINAPI Source_Release(ITfSource *iface)
static HRESULT WINAPI ContextSource_AdviseSink(ITfSource *iface, static HRESULT WINAPI ContextSource_AdviseSink(ITfSource *iface,
REFIID riid, IUnknown *punk, DWORD *pdwCookie) REFIID riid, IUnknown *punk, DWORD *pdwCookie)
{ {
Context *This = impl_from_ITfSource(iface);
ContextSink *es; ContextSink *es;
Context *This = impl_from_ITfSourceVtbl(iface);
TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
if (!riid || !punk || !pdwCookie) if (!riid || !punk || !pdwCookie)
@ -634,8 +643,8 @@ static HRESULT WINAPI ContextSource_AdviseSink(ITfSource *iface,
static HRESULT WINAPI ContextSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) static HRESULT WINAPI ContextSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
{ {
Context *This = impl_from_ITfSource(iface);
ContextSink *sink; ContextSink *sink;
Context *This = impl_from_ITfSourceVtbl(iface);
TRACE("(%p) %x\n",This,pdwCookie); TRACE("(%p) %x\n",This,pdwCookie);
@ -652,14 +661,13 @@ static HRESULT WINAPI ContextSource_UnadviseSink(ITfSource *iface, DWORD pdwCook
return S_OK; return S_OK;
} }
static const ITfSourceVtbl Context_SourceVtbl = static const ITfSourceVtbl ContextSourceVtbl =
{ {
Source_QueryInterface, ContextSource_QueryInterface,
Source_AddRef, ContextSource_AddRef,
Source_Release, ContextSource_Release,
ContextSource_AdviseSink, ContextSource_AdviseSink,
ContextSource_UnadviseSink, ContextSource_UnadviseSink
}; };
/***************************************************** /*****************************************************
@ -667,27 +675,27 @@ static const ITfSourceVtbl Context_SourceVtbl =
*****************************************************/ *****************************************************/
static HRESULT WINAPI InsertAtSelection_QueryInterface(ITfInsertAtSelection *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI InsertAtSelection_QueryInterface(ITfInsertAtSelection *iface, REFIID iid, LPVOID *ppvOut)
{ {
Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); Context *This = impl_from_ITfInsertAtSelection(iface);
return Context_QueryInterface((ITfContext *)This, iid, *ppvOut); return ITfContext_QueryInterface(&This->ITfContext_iface, iid, *ppvOut);
} }
static ULONG WINAPI InsertAtSelection_AddRef(ITfInsertAtSelection *iface) static ULONG WINAPI InsertAtSelection_AddRef(ITfInsertAtSelection *iface)
{ {
Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); Context *This = impl_from_ITfInsertAtSelection(iface);
return Context_AddRef((ITfContext *)This); return ITfContext_AddRef(&This->ITfContext_iface);
} }
static ULONG WINAPI InsertAtSelection_Release(ITfInsertAtSelection *iface) static ULONG WINAPI InsertAtSelection_Release(ITfInsertAtSelection *iface)
{ {
Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); Context *This = impl_from_ITfInsertAtSelection(iface);
return Context_Release((ITfContext *)This); return ITfContext_Release(&This->ITfContext_iface);
} }
static HRESULT WINAPI InsertAtSelection_InsertTextAtSelection( static HRESULT WINAPI InsertAtSelection_InsertTextAtSelection(
ITfInsertAtSelection *iface, TfEditCookie ec, DWORD dwFlags, ITfInsertAtSelection *iface, TfEditCookie ec, DWORD dwFlags,
const WCHAR *pchText, LONG cch, ITfRange **ppRange) const WCHAR *pchText, LONG cch, ITfRange **ppRange)
{ {
Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); Context *This = impl_from_ITfInsertAtSelection(iface);
EditCookie *cookie; EditCookie *cookie;
LONG acpStart, acpEnd; LONG acpStart, acpEnd;
TS_TEXTCHANGE change; TS_TEXTCHANGE change;
@ -723,17 +731,16 @@ static HRESULT WINAPI InsertAtSelection_InsertEmbeddedAtSelection(
ITfInsertAtSelection *iface, TfEditCookie ec, DWORD dwFlags, ITfInsertAtSelection *iface, TfEditCookie ec, DWORD dwFlags,
IDataObject *pDataObject, ITfRange **ppRange) IDataObject *pDataObject, ITfRange **ppRange)
{ {
Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); Context *This = impl_from_ITfInsertAtSelection(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static const ITfInsertAtSelectionVtbl Context_InsertAtSelectionVtbl = static const ITfInsertAtSelectionVtbl InsertAtSelectionVtbl =
{ {
InsertAtSelection_QueryInterface, InsertAtSelection_QueryInterface,
InsertAtSelection_AddRef, InsertAtSelection_AddRef,
InsertAtSelection_Release, InsertAtSelection_Release,
InsertAtSelection_InsertTextAtSelection, InsertAtSelection_InsertTextAtSelection,
InsertAtSelection_InsertEmbeddedAtSelection, InsertAtSelection_InsertEmbeddedAtSelection,
}; };
@ -743,26 +750,26 @@ static const ITfInsertAtSelectionVtbl Context_InsertAtSelectionVtbl =
*****************************************************/ *****************************************************/
static HRESULT WINAPI SourceSingle_QueryInterface(ITfSourceSingle *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI SourceSingle_QueryInterface(ITfSourceSingle *iface, REFIID iid, LPVOID *ppvOut)
{ {
Context *This = impl_from_ITfSourceSingleVtbl(iface); Context *This = impl_from_ITfSourceSingle(iface);
return Context_QueryInterface((ITfContext *)This, iid, *ppvOut); return Context_QueryInterface((ITfContext *)This, iid, *ppvOut);
} }
static ULONG WINAPI SourceSingle_AddRef(ITfSourceSingle *iface) static ULONG WINAPI SourceSingle_AddRef(ITfSourceSingle *iface)
{ {
Context *This = impl_from_ITfSourceSingleVtbl(iface); Context *This = impl_from_ITfSourceSingle(iface);
return Context_AddRef((ITfContext *)This); return Context_AddRef((ITfContext *)This);
} }
static ULONG WINAPI SourceSingle_Release(ITfSourceSingle *iface) static ULONG WINAPI SourceSingle_Release(ITfSourceSingle *iface)
{ {
Context *This = impl_from_ITfSourceSingleVtbl(iface); Context *This = impl_from_ITfSourceSingle(iface);
return Context_Release((ITfContext *)This); return Context_Release((ITfContext *)This);
} }
static HRESULT WINAPI SourceSingle_AdviseSingleSink( ITfSourceSingle *iface, static HRESULT WINAPI SourceSingle_AdviseSingleSink( ITfSourceSingle *iface,
TfClientId tid, REFIID riid, IUnknown *punk) 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); FIXME("STUB:(%p) %i %s %p\n",This, tid, debugstr_guid(riid),punk);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -770,17 +777,16 @@ static HRESULT WINAPI SourceSingle_AdviseSingleSink( ITfSourceSingle *iface,
static HRESULT WINAPI SourceSingle_UnadviseSingleSink( ITfSourceSingle *iface, static HRESULT WINAPI SourceSingle_UnadviseSingleSink( ITfSourceSingle *iface,
TfClientId tid, REFIID riid) 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)); FIXME("STUB:(%p) %i %s\n",This, tid, debugstr_guid(riid));
return E_NOTIMPL; return E_NOTIMPL;
} }
static const ITfSourceSingleVtbl Context_SourceSingleVtbl = static const ITfSourceSingleVtbl ContextSourceSingleVtbl =
{ {
SourceSingle_QueryInterface, SourceSingle_QueryInterface,
SourceSingle_AddRef, SourceSingle_AddRef,
SourceSingle_Release, SourceSingle_Release,
SourceSingle_AdviseSingleSink, SourceSingle_AdviseSingleSink,
SourceSingle_UnadviseSingleSink, SourceSingle_UnadviseSingleSink,
}; };
@ -803,16 +809,16 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfDocumentMgr
TRACE("(%p) %x %p %p %p\n",This, tidOwner, punk, ppOut, pecTextStore); TRACE("(%p) %x %p %p %p\n",This, tidOwner, punk, ppOut, pecTextStore);
This->ContextVtbl= &Context_ContextVtbl; This->ITfContext_iface.lpVtbl= &ContextVtbl;
This->SourceVtbl = &Context_SourceVtbl; This->ITfSource_iface.lpVtbl = &ContextSourceVtbl;
This->InsertAtSelectionVtbl = &Context_InsertAtSelectionVtbl; This->ITfInsertAtSelection_iface.lpVtbl = &InsertAtSelectionVtbl;
This->SourceSingleVtbl = &Context_SourceSingleVtbl; This->ITfSourceSingle_iface.lpVtbl = &ContextSourceSingleVtbl;
This->refCount = 1; This->refCount = 1;
This->tidOwner = tidOwner; This->tidOwner = tidOwner;
This->connected = FALSE; This->connected = FALSE;
This->manager = mgr; 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->lockType = TF_ES_READ;
cookie->pOwningContext = This; cookie->pOwningContext = This;
@ -846,7 +852,7 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfDocumentMgr
HRESULT Context_Initialize(ITfContext *iface, ITfDocumentMgr *manager) HRESULT Context_Initialize(ITfContext *iface, ITfDocumentMgr *manager)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
if (This->pITextStoreACP) if (This->pITextStoreACP)
{ {
@ -861,7 +867,7 @@ HRESULT Context_Initialize(ITfContext *iface, ITfDocumentMgr *manager)
HRESULT Context_Uninitialize(ITfContext *iface) HRESULT Context_Uninitialize(ITfContext *iface)
{ {
Context *This = (Context *)iface; Context *This = impl_from_ITfContext(iface);
if (This->pITextStoreACPSink) if (This->pITextStoreACPSink)
{ {
@ -886,7 +892,7 @@ static void TextStoreACPSink_Destructor(TextStoreACPSink *This)
static HRESULT WINAPI TextStoreACPSink_QueryInterface(ITextStoreACPSink *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI TextStoreACPSink_QueryInterface(ITextStoreACPSink *iface, REFIID iid, LPVOID *ppvOut)
{ {
TextStoreACPSink *This = (TextStoreACPSink *)iface; TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface);
*ppvOut = NULL; *ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITextStoreACPSink)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITextStoreACPSink))
@ -906,13 +912,13 @@ static HRESULT WINAPI TextStoreACPSink_QueryInterface(ITextStoreACPSink *iface,
static ULONG WINAPI TextStoreACPSink_AddRef(ITextStoreACPSink *iface) static ULONG WINAPI TextStoreACPSink_AddRef(ITextStoreACPSink *iface)
{ {
TextStoreACPSink *This = (TextStoreACPSink *)iface; TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface);
return InterlockedIncrement(&This->refCount); return InterlockedIncrement(&This->refCount);
} }
static ULONG WINAPI TextStoreACPSink_Release(ITextStoreACPSink *iface) static ULONG WINAPI TextStoreACPSink_Release(ITextStoreACPSink *iface)
{ {
TextStoreACPSink *This = (TextStoreACPSink *)iface; TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface);
ULONG ret; ULONG ret;
ret = InterlockedDecrement(&This->refCount); ret = InterlockedDecrement(&This->refCount);
@ -928,14 +934,14 @@ static ULONG WINAPI TextStoreACPSink_Release(ITextStoreACPSink *iface)
static HRESULT WINAPI TextStoreACPSink_OnTextChange(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnTextChange(ITextStoreACPSink *iface,
DWORD dwFlags, const TS_TEXTCHANGE *pChange) DWORD dwFlags, const TS_TEXTCHANGE *pChange)
{ {
TextStoreACPSink *This = (TextStoreACPSink *)iface; TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI TextStoreACPSink_OnSelectionChange(ITextStoreACPSink *iface) static HRESULT WINAPI TextStoreACPSink_OnSelectionChange(ITextStoreACPSink *iface)
{ {
TextStoreACPSink *This = (TextStoreACPSink *)iface; TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -943,7 +949,7 @@ static HRESULT WINAPI TextStoreACPSink_OnSelectionChange(ITextStoreACPSink *ifac
static HRESULT WINAPI TextStoreACPSink_OnLayoutChange(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnLayoutChange(ITextStoreACPSink *iface,
TsLayoutCode lcode, TsViewCookie vcView) TsLayoutCode lcode, TsViewCookie vcView)
{ {
TextStoreACPSink *This = (TextStoreACPSink *)iface; TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -951,7 +957,7 @@ static HRESULT WINAPI TextStoreACPSink_OnLayoutChange(ITextStoreACPSink *iface,
static HRESULT WINAPI TextStoreACPSink_OnStatusChange(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnStatusChange(ITextStoreACPSink *iface,
DWORD dwFlags) DWORD dwFlags)
{ {
TextStoreACPSink *This = (TextStoreACPSink *)iface; TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface);
HRESULT hr, hrSession; HRESULT hr, hrSession;
TRACE("(%p) %x\n",This, dwFlags); TRACE("(%p) %x\n",This, dwFlags);
@ -979,7 +985,7 @@ static HRESULT WINAPI TextStoreACPSink_OnStatusChange(ITextStoreACPSink *iface,
static HRESULT WINAPI TextStoreACPSink_OnAttrsChange(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnAttrsChange(ITextStoreACPSink *iface,
LONG acpStart, LONG acpEnd, ULONG cAttrs, const TS_ATTRID *paAttrs) 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); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -987,7 +993,7 @@ static HRESULT WINAPI TextStoreACPSink_OnAttrsChange(ITextStoreACPSink *iface,
static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface,
DWORD dwLockFlags) DWORD dwLockFlags)
{ {
TextStoreACPSink *This = (TextStoreACPSink *)iface; TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface);
HRESULT hr; HRESULT hr;
EditCookie *cookie,*sinkcookie; EditCookie *cookie,*sinkcookie;
TfEditCookie ec; TfEditCookie ec;
@ -1055,24 +1061,23 @@ static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface,
static HRESULT WINAPI TextStoreACPSink_OnStartEditTransaction(ITextStoreACPSink *iface) static HRESULT WINAPI TextStoreACPSink_OnStartEditTransaction(ITextStoreACPSink *iface)
{ {
TextStoreACPSink *This = (TextStoreACPSink *)iface; TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI TextStoreACPSink_OnEndEditTransaction(ITextStoreACPSink *iface) static HRESULT WINAPI TextStoreACPSink_OnEndEditTransaction(ITextStoreACPSink *iface)
{ {
TextStoreACPSink *This = (TextStoreACPSink *)iface; TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static const ITextStoreACPSinkVtbl TextStoreACPSink_TextStoreACPSinkVtbl = static const ITextStoreACPSinkVtbl TextStoreACPSinkVtbl =
{ {
TextStoreACPSink_QueryInterface, TextStoreACPSink_QueryInterface,
TextStoreACPSink_AddRef, TextStoreACPSink_AddRef,
TextStoreACPSink_Release, TextStoreACPSink_Release,
TextStoreACPSink_OnTextChange, TextStoreACPSink_OnTextChange,
TextStoreACPSink_OnSelectionChange, TextStoreACPSink_OnSelectionChange,
TextStoreACPSink_OnLayoutChange, TextStoreACPSink_OnLayoutChange,
@ -1091,12 +1096,12 @@ static HRESULT TextStoreACPSink_Constructor(ITextStoreACPSink **ppOut, Context *
if (This == NULL) if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->TextStoreACPSinkVtbl= &TextStoreACPSink_TextStoreACPSinkVtbl; This->ITextStoreACPSink_iface.lpVtbl= &TextStoreACPSinkVtbl;
This->refCount = 1; This->refCount = 1;
This->pContext = pContext; This->pContext = pContext;
TRACE("returning %p\n", This); TRACE("returning %p\n", This);
*ppOut = (ITextStoreACPSink*)This; *ppOut = &This->ITextStoreACPSink_iface;
return S_OK; return S_OK;
} }

View File

@ -56,7 +56,7 @@ static HRESULT WINAPI DisplayAttributeMgr_QueryInterface(ITfDisplayAttributeMgr
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfDisplayAttributeMgr)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfDisplayAttributeMgr))
{ {
*ppvOut = This; *ppvOut = &This->ITfDisplayAttributeMgr_iface;
} }
if (*ppvOut) if (*ppvOut)

View File

@ -100,7 +100,7 @@ static HRESULT WINAPI DocumentMgr_QueryInterface(ITfDocumentMgr *iface, REFIID i
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfDocumentMgr)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfDocumentMgr))
{ {
*ppvOut = This; *ppvOut = &This->ITfDocumentMgr_iface;
} }
else if (IsEqualIID(iid, &IID_ITfSource)) else if (IsEqualIID(iid, &IID_ITfSource))
{ {
@ -280,19 +280,19 @@ static const ITfDocumentMgrVtbl DocumentMgr_DocumentMgrVtbl =
static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut)
{ {
DocumentMgr *This = impl_from_ITfSource(iface); 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 Source_AddRef(ITfSource *iface)
{ {
DocumentMgr *This = impl_from_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 Source_Release(ITfSource *iface)
{ {
DocumentMgr *This = impl_from_ITfSource(iface); DocumentMgr *This = impl_from_ITfSource(iface);
return DocumentMgr_Release(&This->ITfDocumentMgr_iface); return ITfDocumentMgr_Release(&This->ITfDocumentMgr_iface);
} }
/***************************************************** /*****************************************************
@ -359,7 +359,7 @@ static HRESULT WINAPI EnumTfContext_QueryInterface(IEnumTfContexts *iface, REFII
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfContexts)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfContexts))
{ {
*ppvOut = This; *ppvOut = &This->IEnumTfContexts_iface;
} }
if (*ppvOut) if (*ppvOut)

View File

@ -62,8 +62,8 @@ typedef struct tagInputProcessorProfilesSink {
} InputProcessorProfilesSink; } InputProcessorProfilesSink;
typedef struct tagInputProcessorProfiles { typedef struct tagInputProcessorProfiles {
const ITfInputProcessorProfilesVtbl *InputProcessorProfilesVtbl; ITfInputProcessorProfiles ITfInputProcessorProfiles_iface;
const ITfSourceVtbl *SourceVtbl; ITfSource ITfSource_iface;
/* const ITfInputProcessorProfileMgrVtbl *InputProcessorProfileMgrVtbl; */ /* const ITfInputProcessorProfileMgrVtbl *InputProcessorProfileMgrVtbl; */
/* const ITfInputProcessorProfilesExVtbl *InputProcessorProfilesExVtbl; */ /* const ITfInputProcessorProfilesExVtbl *InputProcessorProfilesExVtbl; */
/* const ITfInputProcessorProfileSubstituteLayoutVtbl *InputProcessorProfileSubstituteLayoutVtbl; */ /* const ITfInputProcessorProfileSubstituteLayoutVtbl *InputProcessorProfileSubstituteLayoutVtbl; */
@ -75,7 +75,7 @@ typedef struct tagInputProcessorProfiles {
} InputProcessorProfiles; } InputProcessorProfiles;
typedef struct tagProfilesEnumGuid { typedef struct tagProfilesEnumGuid {
const IEnumGUIDVtbl *Vtbl; IEnumGUID IEnumGUID_iface;
LONG refCount; LONG refCount;
HKEY key; HKEY key;
@ -83,7 +83,7 @@ typedef struct tagProfilesEnumGuid {
} ProfilesEnumGuid; } ProfilesEnumGuid;
typedef struct tagEnumTfLanguageProfiles { typedef struct tagEnumTfLanguageProfiles {
const IEnumTfLanguageProfilesVtbl *Vtbl; IEnumTfLanguageProfiles IEnumTfLanguageProfiles_iface;
LONG refCount; LONG refCount;
HKEY tipkey; HKEY tipkey;
@ -100,9 +100,24 @@ typedef struct tagEnumTfLanguageProfiles {
static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut); static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut);
static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **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) static void free_sink(InputProcessorProfilesSink *sink)
@ -158,16 +173,16 @@ static void add_userkey( REFCLSID rclsid, LANGID langid,
static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorProfiles *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorProfiles *iface, REFIID iid, LPVOID *ppvOut)
{ {
InputProcessorProfiles *This = (InputProcessorProfiles *)iface; InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
*ppvOut = NULL; *ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfInputProcessorProfiles)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfInputProcessorProfiles))
{ {
*ppvOut = This; *ppvOut = &This->ITfInputProcessorProfiles_iface;
} }
else if (IsEqualIID(iid, &IID_ITfSource)) else if (IsEqualIID(iid, &IID_ITfSource))
{ {
*ppvOut = &This->SourceVtbl; *ppvOut = &This->ITfSource_iface;
} }
if (*ppvOut) if (*ppvOut)
@ -182,13 +197,13 @@ static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorPro
static ULONG WINAPI InputProcessorProfiles_AddRef(ITfInputProcessorProfiles *iface) static ULONG WINAPI InputProcessorProfiles_AddRef(ITfInputProcessorProfiles *iface)
{ {
InputProcessorProfiles *This = (InputProcessorProfiles *)iface; InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
return InterlockedIncrement(&This->refCount); return InterlockedIncrement(&This->refCount);
} }
static ULONG WINAPI InputProcessorProfiles_Release(ITfInputProcessorProfiles *iface) static ULONG WINAPI InputProcessorProfiles_Release(ITfInputProcessorProfiles *iface)
{ {
InputProcessorProfiles *This = (InputProcessorProfiles *)iface; InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
ULONG ret; ULONG ret;
ret = InterlockedDecrement(&This->refCount); ret = InterlockedDecrement(&This->refCount);
@ -203,7 +218,7 @@ static ULONG WINAPI InputProcessorProfiles_Release(ITfInputProcessorProfiles *if
static HRESULT WINAPI InputProcessorProfiles_Register( static HRESULT WINAPI InputProcessorProfiles_Register(
ITfInputProcessorProfiles *iface, REFCLSID rclsid) ITfInputProcessorProfiles *iface, REFCLSID rclsid)
{ {
InputProcessorProfiles *This = (InputProcessorProfiles*)iface; InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
HKEY tipkey; HKEY tipkey;
WCHAR buf[39]; WCHAR buf[39];
WCHAR fullkey[68]; WCHAR fullkey[68];
@ -225,9 +240,9 @@ static HRESULT WINAPI InputProcessorProfiles_Register(
static HRESULT WINAPI InputProcessorProfiles_Unregister( static HRESULT WINAPI InputProcessorProfiles_Unregister(
ITfInputProcessorProfiles *iface, REFCLSID rclsid) ITfInputProcessorProfiles *iface, REFCLSID rclsid)
{ {
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
WCHAR buf[39]; WCHAR buf[39];
WCHAR fullkey[68]; WCHAR fullkey[68];
InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("(%p) %s\n",This,debugstr_guid(rclsid)); TRACE("(%p) %s\n",This,debugstr_guid(rclsid));
@ -246,6 +261,7 @@ static HRESULT WINAPI InputProcessorProfiles_AddLanguageProfile(
ULONG cchDesc, const WCHAR *pchIconFile, ULONG cchFile, ULONG cchDesc, const WCHAR *pchIconFile, ULONG cchFile,
ULONG uIconIndex) ULONG uIconIndex)
{ {
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
HKEY tipkey,fmtkey; HKEY tipkey,fmtkey;
WCHAR buf[39]; WCHAR buf[39];
WCHAR fullkey[100]; WCHAR fullkey[100];
@ -257,8 +273,6 @@ static HRESULT WINAPI InputProcessorProfiles_AddLanguageProfile(
static const WCHAR icnf[] = {'I','c','o','n','F','i','l','e',0}; static const WCHAR icnf[] = {'I','c','o','n','F','i','l','e',0};
static const WCHAR icni[] = {'I','c','o','n','I','n','d','e','x',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, TRACE("(%p) %s %x %s %s %s %i\n",This,debugstr_guid(rclsid), langid,
debugstr_guid(guidProfile), debugstr_wn(pchDesc,cchDesc), debugstr_guid(guidProfile), debugstr_wn(pchDesc,cchDesc),
debugstr_wn(pchIconFile,cchFile),uIconIndex); debugstr_wn(pchIconFile,cchFile),uIconIndex);
@ -300,7 +314,7 @@ static HRESULT WINAPI InputProcessorProfiles_RemoveLanguageProfile(
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfile) REFGUID guidProfile)
{ {
InputProcessorProfiles *This = (InputProcessorProfiles*)iface; InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -308,7 +322,7 @@ static HRESULT WINAPI InputProcessorProfiles_RemoveLanguageProfile(
static HRESULT WINAPI InputProcessorProfiles_EnumInputProcessorInfo( static HRESULT WINAPI InputProcessorProfiles_EnumInputProcessorInfo(
ITfInputProcessorProfiles *iface, IEnumGUID **ppEnum) ITfInputProcessorProfiles *iface, IEnumGUID **ppEnum)
{ {
InputProcessorProfiles *This = (InputProcessorProfiles*)iface; InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
TRACE("(%p) %p\n",This,ppEnum); TRACE("(%p) %p\n",This,ppEnum);
return ProfilesEnumGuid_Constructor(ppEnum); return ProfilesEnumGuid_Constructor(ppEnum);
} }
@ -317,12 +331,12 @@ static HRESULT WINAPI InputProcessorProfiles_GetDefaultLanguageProfile(
ITfInputProcessorProfiles *iface, LANGID langid, REFGUID catid, ITfInputProcessorProfiles *iface, LANGID langid, REFGUID catid,
CLSID *pclsid, GUID *pguidProfile) CLSID *pclsid, GUID *pguidProfile)
{ {
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
WCHAR fullkey[168]; WCHAR fullkey[168];
WCHAR buf[39]; WCHAR buf[39];
HKEY hkey; HKEY hkey;
DWORD count; DWORD count;
ULONG res; ULONG res;
InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("%p) %x %s %p %p\n",This, langid, debugstr_guid(catid),pclsid,pguidProfile); TRACE("%p) %x %s %p %p\n",This, langid, debugstr_guid(catid),pclsid,pguidProfile);
@ -358,13 +372,13 @@ static HRESULT WINAPI InputProcessorProfiles_SetDefaultLanguageProfile(
ITfInputProcessorProfiles *iface, LANGID langid, REFCLSID rclsid, ITfInputProcessorProfiles *iface, LANGID langid, REFCLSID rclsid,
REFGUID guidProfiles) REFGUID guidProfiles)
{ {
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
WCHAR fullkey[168]; WCHAR fullkey[168];
WCHAR buf[39]; WCHAR buf[39];
HKEY hkey; HKEY hkey;
GUID catid; GUID catid;
HRESULT hr; HRESULT hr;
ITfCategoryMgr *catmgr; ITfCategoryMgr *catmgr;
InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
static const GUID * tipcats[3] = { &GUID_TFCAT_TIP_KEYBOARD, static const GUID * tipcats[3] = { &GUID_TFCAT_TIP_KEYBOARD,
&GUID_TFCAT_TIP_SPEECH, &GUID_TFCAT_TIP_SPEECH,
&GUID_TFCAT_TIP_HANDWRITING }; &GUID_TFCAT_TIP_HANDWRITING };
@ -408,10 +422,10 @@ static HRESULT WINAPI InputProcessorProfiles_ActivateLanguageProfile(
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfiles) REFGUID guidProfiles)
{ {
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
HRESULT hr; HRESULT hr;
BOOL enabled; BOOL enabled;
TF_LANGUAGEPROFILE LanguageProfile; TF_LANGUAGEPROFILE LanguageProfile;
InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("(%p) %s %x %s\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfiles)); TRACE("(%p) %s %x %s\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfiles));
@ -444,8 +458,8 @@ static HRESULT WINAPI InputProcessorProfiles_GetActiveLanguageProfile(
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID *plangid, ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID *plangid,
GUID *pguidProfile) GUID *pguidProfile)
{ {
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
TF_LANGUAGEPROFILE profile; TF_LANGUAGEPROFILE profile;
InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("(%p) %s %p %p\n",This,debugstr_guid(rclsid),plangid,pguidProfile); TRACE("(%p) %s %p %p\n",This,debugstr_guid(rclsid),plangid,pguidProfile);
@ -469,7 +483,7 @@ static HRESULT WINAPI InputProcessorProfiles_GetLanguageProfileDescription(
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfile, BSTR *pbstrProfile) REFGUID guidProfile, BSTR *pbstrProfile)
{ {
InputProcessorProfiles *This = (InputProcessorProfiles*)iface; InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -477,7 +491,7 @@ static HRESULT WINAPI InputProcessorProfiles_GetLanguageProfileDescription(
static HRESULT WINAPI InputProcessorProfiles_GetCurrentLanguage( static HRESULT WINAPI InputProcessorProfiles_GetCurrentLanguage(
ITfInputProcessorProfiles *iface, LANGID *plangid) ITfInputProcessorProfiles *iface, LANGID *plangid)
{ {
InputProcessorProfiles *This = (InputProcessorProfiles*)iface; InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
TRACE("(%p) 0x%x\n",This,This->currentLanguage); TRACE("(%p) 0x%x\n",This,This->currentLanguage);
if (!plangid) if (!plangid)
@ -491,8 +505,8 @@ static HRESULT WINAPI InputProcessorProfiles_GetCurrentLanguage(
static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage( static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage(
ITfInputProcessorProfiles *iface, LANGID langid) ITfInputProcessorProfiles *iface, LANGID langid)
{ {
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
struct list *cursor; struct list *cursor;
InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
BOOL accept; BOOL accept;
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
@ -513,7 +527,7 @@ static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage(
static HRESULT WINAPI InputProcessorProfiles_GetLanguageList( static HRESULT WINAPI InputProcessorProfiles_GetLanguageList(
ITfInputProcessorProfiles *iface, LANGID **ppLangId, ULONG *pulCount) ITfInputProcessorProfiles *iface, LANGID **ppLangId, ULONG *pulCount)
{ {
InputProcessorProfiles *This = (InputProcessorProfiles*)iface; InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
FIXME("Semi-STUB:(%p)\n",This); FIXME("Semi-STUB:(%p)\n",This);
*ppLangId = CoTaskMemAlloc(sizeof(LANGID)); *ppLangId = CoTaskMemAlloc(sizeof(LANGID));
**ppLangId = This->currentLanguage; **ppLangId = This->currentLanguage;
@ -525,7 +539,7 @@ static HRESULT WINAPI InputProcessorProfiles_EnumLanguageProfiles(
ITfInputProcessorProfiles *iface, LANGID langid, ITfInputProcessorProfiles *iface, LANGID langid,
IEnumTfLanguageProfiles **ppEnum) IEnumTfLanguageProfiles **ppEnum)
{ {
InputProcessorProfiles *This = (InputProcessorProfiles*)iface; InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
TRACE("(%p) %x %p\n",This,langid,ppEnum); TRACE("(%p) %x %p\n",This,langid,ppEnum);
return EnumTfLanguageProfiles_Constructor(langid, ppEnum); return EnumTfLanguageProfiles_Constructor(langid, ppEnum);
} }
@ -534,13 +548,13 @@ static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfile(
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfile, BOOL fEnable) REFGUID guidProfile, BOOL fEnable)
{ {
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
HKEY key; HKEY key;
WCHAR buf[39]; WCHAR buf[39];
WCHAR buf2[39]; WCHAR buf2[39];
WCHAR fullkey[168]; WCHAR fullkey[168];
ULONG res; ULONG res;
InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("(%p) %s %x %s %i\n",This, debugstr_guid(rclsid), langid, debugstr_guid(guidProfile), fEnable); TRACE("(%p) %s %x %s %i\n",This, debugstr_guid(rclsid), langid, debugstr_guid(guidProfile), fEnable);
StringFromGUID2(rclsid, buf, 39); StringFromGUID2(rclsid, buf, 39);
@ -564,13 +578,13 @@ static HRESULT WINAPI InputProcessorProfiles_IsEnabledLanguageProfile(
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfile, BOOL *pfEnable) REFGUID guidProfile, BOOL *pfEnable)
{ {
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
HKEY key; HKEY key;
WCHAR buf[39]; WCHAR buf[39];
WCHAR buf2[39]; WCHAR buf2[39];
WCHAR fullkey[168]; WCHAR fullkey[168];
ULONG res; ULONG res;
InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("(%p) %s, %i, %s, %p\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfile),pfEnable); TRACE("(%p) %s, %i, %s, %p\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfile),pfEnable);
if (!pfEnable) if (!pfEnable)
@ -611,13 +625,13 @@ static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfileByDefault(
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfile, BOOL fEnable) REFGUID guidProfile, BOOL fEnable)
{ {
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
HKEY key; HKEY key;
WCHAR buf[39]; WCHAR buf[39];
WCHAR buf2[39]; WCHAR buf2[39];
WCHAR fullkey[168]; WCHAR fullkey[168];
ULONG res; ULONG res;
InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("(%p) %s %x %s %i\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfile),fEnable); TRACE("(%p) %s %x %s %i\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfile),fEnable);
StringFromGUID2(rclsid, buf, 39); StringFromGUID2(rclsid, buf, 39);
@ -641,18 +655,16 @@ static HRESULT WINAPI InputProcessorProfiles_SubstituteKeyboardLayout(
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfile, HKL hKL) REFGUID guidProfile, HKL hKL)
{ {
InputProcessorProfiles *This = (InputProcessorProfiles*)iface; InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static const ITfInputProcessorProfilesVtbl InputProcessorProfilesVtbl =
static const ITfInputProcessorProfilesVtbl InputProcessorProfiles_InputProcessorProfilesVtbl =
{ {
InputProcessorProfiles_QueryInterface, InputProcessorProfiles_QueryInterface,
InputProcessorProfiles_AddRef, InputProcessorProfiles_AddRef,
InputProcessorProfiles_Release, InputProcessorProfiles_Release,
InputProcessorProfiles_Register, InputProcessorProfiles_Register,
InputProcessorProfiles_Unregister, InputProcessorProfiles_Unregister,
InputProcessorProfiles_AddLanguageProfile, InputProcessorProfiles_AddLanguageProfile,
@ -678,27 +690,27 @@ static const ITfInputProcessorProfilesVtbl InputProcessorProfiles_InputProcessor
*****************************************************/ *****************************************************/
static HRESULT WINAPI IPPSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI IPPSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut)
{ {
InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); InputProcessorProfiles *This = impl_from_ITfSource(iface);
return InputProcessorProfiles_QueryInterface((ITfInputProcessorProfiles *)This, iid, *ppvOut); return ITfInputProcessorProfiles_QueryInterface(&This->ITfInputProcessorProfiles_iface, iid, *ppvOut);
} }
static ULONG WINAPI IPPSource_AddRef(ITfSource *iface) static ULONG WINAPI IPPSource_AddRef(ITfSource *iface)
{ {
InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); InputProcessorProfiles *This = impl_from_ITfSource(iface);
return InputProcessorProfiles_AddRef((ITfInputProcessorProfiles*)This); return ITfInputProcessorProfiles_AddRef(&This->ITfInputProcessorProfiles_iface);
} }
static ULONG WINAPI IPPSource_Release(ITfSource *iface) static ULONG WINAPI IPPSource_Release(ITfSource *iface)
{ {
InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); InputProcessorProfiles *This = impl_from_ITfSource(iface);
return InputProcessorProfiles_Release((ITfInputProcessorProfiles *)This); return ITfInputProcessorProfiles_Release(&This->ITfInputProcessorProfiles_iface);
} }
static HRESULT WINAPI IPPSource_AdviseSink(ITfSource *iface, static HRESULT WINAPI IPPSource_AdviseSink(ITfSource *iface,
REFIID riid, IUnknown *punk, DWORD *pdwCookie) REFIID riid, IUnknown *punk, DWORD *pdwCookie)
{ {
InputProcessorProfiles *This = impl_from_ITfSource(iface);
InputProcessorProfilesSink *ipps; InputProcessorProfilesSink *ipps;
InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface);
TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
@ -731,8 +743,8 @@ static HRESULT WINAPI IPPSource_AdviseSink(ITfSource *iface,
static HRESULT WINAPI IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) static HRESULT WINAPI IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
{ {
InputProcessorProfiles *This = impl_from_ITfSource(iface);
InputProcessorProfilesSink *sink; InputProcessorProfilesSink *sink;
InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface);
TRACE("(%p) %x\n",This,pdwCookie); TRACE("(%p) %x\n",This,pdwCookie);
@ -749,12 +761,11 @@ static HRESULT WINAPI IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
return S_OK; return S_OK;
} }
static const ITfSourceVtbl InputProcessorProfiles_SourceVtbl = static const ITfSourceVtbl InputProcessorProfilesSourceVtbl =
{ {
IPPSource_QueryInterface, IPPSource_QueryInterface,
IPPSource_AddRef, IPPSource_AddRef,
IPPSource_Release, IPPSource_Release,
IPPSource_AdviseSink, IPPSource_AdviseSink,
IPPSource_UnadviseSink, IPPSource_UnadviseSink,
}; };
@ -769,8 +780,8 @@ HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut
if (This == NULL) if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->InputProcessorProfilesVtbl= &InputProcessorProfiles_InputProcessorProfilesVtbl; This->ITfInputProcessorProfiles_iface.lpVtbl= &InputProcessorProfilesVtbl;
This->SourceVtbl = &InputProcessorProfiles_SourceVtbl; This->ITfSource_iface.lpVtbl = &InputProcessorProfilesSourceVtbl;
This->refCount = 1; This->refCount = 1;
This->currentLanguage = GetUserDefaultLCID(); This->currentLanguage = GetUserDefaultLCID();
@ -793,12 +804,12 @@ static void ProfilesEnumGuid_Destructor(ProfilesEnumGuid *This)
static HRESULT WINAPI ProfilesEnumGuid_QueryInterface(IEnumGUID *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI ProfilesEnumGuid_QueryInterface(IEnumGUID *iface, REFIID iid, LPVOID *ppvOut)
{ {
ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
*ppvOut = NULL; *ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumGUID)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumGUID))
{ {
*ppvOut = This; *ppvOut = &This->IEnumGUID_iface;
} }
if (*ppvOut) if (*ppvOut)
@ -813,13 +824,13 @@ static HRESULT WINAPI ProfilesEnumGuid_QueryInterface(IEnumGUID *iface, REFIID i
static ULONG WINAPI ProfilesEnumGuid_AddRef(IEnumGUID *iface) static ULONG WINAPI ProfilesEnumGuid_AddRef(IEnumGUID *iface)
{ {
ProfilesEnumGuid *This = (ProfilesEnumGuid*)iface; ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
return InterlockedIncrement(&This->refCount); return InterlockedIncrement(&This->refCount);
} }
static ULONG WINAPI ProfilesEnumGuid_Release(IEnumGUID *iface) static ULONG WINAPI ProfilesEnumGuid_Release(IEnumGUID *iface)
{ {
ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
ULONG ret; ULONG ret;
ret = InterlockedDecrement(&This->refCount); ret = InterlockedDecrement(&This->refCount);
@ -834,7 +845,7 @@ static ULONG WINAPI ProfilesEnumGuid_Release(IEnumGUID *iface)
static HRESULT WINAPI ProfilesEnumGuid_Next( LPENUMGUID iface, static HRESULT WINAPI ProfilesEnumGuid_Next( LPENUMGUID iface,
ULONG celt, GUID *rgelt, ULONG *pceltFetched) ULONG celt, GUID *rgelt, ULONG *pceltFetched)
{ {
ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
ULONG fetched = 0; ULONG fetched = 0;
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
@ -866,7 +877,7 @@ static HRESULT WINAPI ProfilesEnumGuid_Next( LPENUMGUID iface,
static HRESULT WINAPI ProfilesEnumGuid_Skip( LPENUMGUID iface, ULONG celt) static HRESULT WINAPI ProfilesEnumGuid_Skip( LPENUMGUID iface, ULONG celt)
{ {
ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
This->next_index += celt; This->next_index += celt;
@ -875,7 +886,7 @@ static HRESULT WINAPI ProfilesEnumGuid_Skip( LPENUMGUID iface, ULONG celt)
static HRESULT WINAPI ProfilesEnumGuid_Reset( LPENUMGUID iface) static HRESULT WINAPI ProfilesEnumGuid_Reset( LPENUMGUID iface)
{ {
ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
This->next_index = 0; This->next_index = 0;
return S_OK; return S_OK;
@ -884,7 +895,7 @@ static HRESULT WINAPI ProfilesEnumGuid_Reset( LPENUMGUID iface)
static HRESULT WINAPI ProfilesEnumGuid_Clone( LPENUMGUID iface, static HRESULT WINAPI ProfilesEnumGuid_Clone( LPENUMGUID iface,
IEnumGUID **ppenum) IEnumGUID **ppenum)
{ {
ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
HRESULT res; HRESULT res;
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
@ -894,17 +905,17 @@ static HRESULT WINAPI ProfilesEnumGuid_Clone( LPENUMGUID iface,
res = ProfilesEnumGuid_Constructor(ppenum); res = ProfilesEnumGuid_Constructor(ppenum);
if (SUCCEEDED(res)) if (SUCCEEDED(res))
{ {
ProfilesEnumGuid *new_This = (ProfilesEnumGuid *)*ppenum; ProfilesEnumGuid *new_This = impl_from_IEnumGUID(*ppenum);
new_This->next_index = This->next_index; new_This->next_index = This->next_index;
} }
return res; return res;
} }
static const IEnumGUIDVtbl IEnumGUID_Vtbl ={ static const IEnumGUIDVtbl EnumGUIDVtbl =
{
ProfilesEnumGuid_QueryInterface, ProfilesEnumGuid_QueryInterface,
ProfilesEnumGuid_AddRef, ProfilesEnumGuid_AddRef,
ProfilesEnumGuid_Release, ProfilesEnumGuid_Release,
ProfilesEnumGuid_Next, ProfilesEnumGuid_Next,
ProfilesEnumGuid_Skip, ProfilesEnumGuid_Skip,
ProfilesEnumGuid_Reset, ProfilesEnumGuid_Reset,
@ -919,7 +930,7 @@ static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut)
if (This == NULL) if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->Vtbl= &IEnumGUID_Vtbl; This->IEnumGUID_iface.lpVtbl= &EnumGUIDVtbl;
This->refCount = 1; This->refCount = 1;
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0, if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0,
@ -949,12 +960,13 @@ static void EnumTfLanguageProfiles_Destructor(EnumTfLanguageProfiles *This)
static HRESULT WINAPI EnumTfLanguageProfiles_QueryInterface(IEnumTfLanguageProfiles *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI EnumTfLanguageProfiles_QueryInterface(IEnumTfLanguageProfiles *iface, REFIID iid, LPVOID *ppvOut)
{ {
EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
*ppvOut = NULL; *ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfLanguageProfiles)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfLanguageProfiles))
{ {
*ppvOut = This; *ppvOut = &This->IEnumTfLanguageProfiles_iface;
} }
if (*ppvOut) if (*ppvOut)
@ -969,13 +981,13 @@ static HRESULT WINAPI EnumTfLanguageProfiles_QueryInterface(IEnumTfLanguageProfi
static ULONG WINAPI EnumTfLanguageProfiles_AddRef(IEnumTfLanguageProfiles *iface) static ULONG WINAPI EnumTfLanguageProfiles_AddRef(IEnumTfLanguageProfiles *iface)
{ {
EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles*)iface; EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
return InterlockedIncrement(&This->refCount); return InterlockedIncrement(&This->refCount);
} }
static ULONG WINAPI EnumTfLanguageProfiles_Release(IEnumTfLanguageProfiles *iface) static ULONG WINAPI EnumTfLanguageProfiles_Release(IEnumTfLanguageProfiles *iface)
{ {
EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
ULONG ret; ULONG ret;
ret = InterlockedDecrement(&This->refCount); ret = InterlockedDecrement(&This->refCount);
@ -1042,7 +1054,7 @@ static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LA
static HRESULT WINAPI EnumTfLanguageProfiles_Next(IEnumTfLanguageProfiles *iface, static HRESULT WINAPI EnumTfLanguageProfiles_Next(IEnumTfLanguageProfiles *iface,
ULONG ulCount, TF_LANGUAGEPROFILE *pProfile, ULONG *pcFetch) ULONG ulCount, TF_LANGUAGEPROFILE *pProfile, ULONG *pcFetch)
{ {
EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
ULONG fetched = 0; ULONG fetched = 0;
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
@ -1084,14 +1096,14 @@ static HRESULT WINAPI EnumTfLanguageProfiles_Next(IEnumTfLanguageProfiles *iface
static HRESULT WINAPI EnumTfLanguageProfiles_Skip( IEnumTfLanguageProfiles* iface, ULONG celt) static HRESULT WINAPI EnumTfLanguageProfiles_Skip( IEnumTfLanguageProfiles* iface, ULONG celt)
{ {
EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
FIXME("STUB (%p)\n",This); FIXME("STUB (%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI EnumTfLanguageProfiles_Reset( IEnumTfLanguageProfiles* iface) static HRESULT WINAPI EnumTfLanguageProfiles_Reset( IEnumTfLanguageProfiles* iface)
{ {
EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
This->tip_index = 0; This->tip_index = 0;
if (This->langkey) if (This->langkey)
@ -1104,7 +1116,7 @@ static HRESULT WINAPI EnumTfLanguageProfiles_Reset( IEnumTfLanguageProfiles* ifa
static HRESULT WINAPI EnumTfLanguageProfiles_Clone( IEnumTfLanguageProfiles *iface, static HRESULT WINAPI EnumTfLanguageProfiles_Clone( IEnumTfLanguageProfiles *iface,
IEnumTfLanguageProfiles **ppenum) IEnumTfLanguageProfiles **ppenum)
{ {
EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
HRESULT res; HRESULT res;
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
@ -1131,11 +1143,11 @@ static HRESULT WINAPI EnumTfLanguageProfiles_Clone( IEnumTfLanguageProfiles *ifa
return res; return res;
} }
static const IEnumTfLanguageProfilesVtbl IEnumTfLanguageProfiles_Vtbl ={ static const IEnumTfLanguageProfilesVtbl EnumTfLanguageProfilesVtbl =
{
EnumTfLanguageProfiles_QueryInterface, EnumTfLanguageProfiles_QueryInterface,
EnumTfLanguageProfiles_AddRef, EnumTfLanguageProfiles_AddRef,
EnumTfLanguageProfiles_Release, EnumTfLanguageProfiles_Release,
EnumTfLanguageProfiles_Clone, EnumTfLanguageProfiles_Clone,
EnumTfLanguageProfiles_Next, EnumTfLanguageProfiles_Next,
EnumTfLanguageProfiles_Reset, EnumTfLanguageProfiles_Reset,
@ -1151,7 +1163,7 @@ static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguage
if (This == NULL) if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->Vtbl= &IEnumTfLanguageProfiles_Vtbl; This->IEnumTfLanguageProfiles_iface.lpVtbl= &EnumTfLanguageProfilesVtbl;
This->refCount = 1; This->refCount = 1;
This->langid = langid; This->langid = langid;

View File

@ -56,7 +56,7 @@ static HRESULT WINAPI LangBarMgr_QueryInterface(ITfLangBarMgr *iface, REFIID iid
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfLangBarMgr)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfLangBarMgr))
{ {
*ppvOut = This; *ppvOut = &This->ITfLangBarMgr_iface;
} }
if (*ppvOut) if (*ppvOut)

View File

@ -72,7 +72,7 @@ static HRESULT WINAPI Range_QueryInterface(ITfRange *iface, REFIID iid, LPVOID *
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfRange)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfRange))
{ {
*ppvOut = This; *ppvOut = &This->ITfRange_iface;
} }
if (*ppvOut) if (*ppvOut)
@ -359,7 +359,7 @@ HRESULT TF_SELECTION_to_TS_SELECTION_ACP(const TF_SELECTION *tf, TS_SELECTION_AC
if (!tf || !tsAcp || !tf->range) if (!tf || !tsAcp || !tf->range)
return E_INVALIDARG; return E_INVALIDARG;
This = (Range *)tf->range; This = impl_from_ITfRange(tf->range);
tsAcp->acpStart = This->anchorStart; tsAcp->acpStart = This->anchorStart;
tsAcp->acpEnd = This->anchorEnd; tsAcp->acpEnd = This->anchorEnd;

View File

@ -79,22 +79,22 @@ typedef struct tagAssociatedWindow
} AssociatedWindow; } AssociatedWindow;
typedef struct tagACLMulti { typedef struct tagACLMulti {
const ITfThreadMgrVtbl *ThreadMgrVtbl; ITfThreadMgr ITfThreadMgr_iface;
const ITfSourceVtbl *SourceVtbl; ITfSource ITfSource_iface;
const ITfKeystrokeMgrVtbl *KeystrokeMgrVtbl; ITfKeystrokeMgr ITfKeystrokeMgr_iface;
const ITfMessagePumpVtbl *MessagePumpVtbl; ITfMessagePump ITfMessagePump_iface;
const ITfClientIdVtbl *ClientIdVtbl; ITfClientId ITfClientId_iface;
/* const ITfThreadMgrExVtbl *ThreadMgrExVtbl; */ /* const ITfThreadMgrExVtbl *ThreadMgrExVtbl; */
/* const ITfConfigureSystemKeystrokeFeedVtbl *ConfigureSystemKeystrokeFeedVtbl; */ /* const ITfConfigureSystemKeystrokeFeedVtbl *ConfigureSystemKeystrokeFeedVtbl; */
/* const ITfLangBarItemMgrVtbl *LangBarItemMgrVtbl; */ /* const ITfLangBarItemMgrVtbl *LangBarItemMgrVtbl; */
/* const ITfUIElementMgrVtbl *UIElementMgrVtbl; */ /* const ITfUIElementMgrVtbl *UIElementMgrVtbl; */
const ITfSourceSingleVtbl *SourceSingleVtbl; ITfSourceSingle ITfSourceSingle_iface;
LONG refCount; LONG refCount;
/* Aggregation */ /* Aggregation */
ITfCompartmentMgr *CompartmentMgr; ITfCompartmentMgr *CompartmentMgr;
const ITfThreadMgrEventSinkVtbl *ThreadMgrEventSinkVtbl; /* internal */ ITfThreadMgrEventSink ITfThreadMgrEventSink_iface; /* internal */
ITfDocumentMgr *focus; ITfDocumentMgr *focus;
LONG activationCount; LONG activationCount;
@ -118,7 +118,7 @@ typedef struct tagACLMulti {
} ThreadMgr; } ThreadMgr;
typedef struct tagEnumTfDocumentMgr { typedef struct tagEnumTfDocumentMgr {
const IEnumTfDocumentMgrsVtbl *Vtbl; IEnumTfDocumentMgrs IEnumTfDocumentMgrs_iface;
LONG refCount; LONG refCount;
struct list *index; struct list *index;
@ -127,35 +127,44 @@ typedef struct tagEnumTfDocumentMgr {
static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentMgrs **ppOut); 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) static inline ThreadMgr *impl_from_ITfThreadMgrEventSink(ITfThreadMgrEventSink *iface)
{ {
return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,ThreadMgrEventSinkVtbl)); return CONTAINING_RECORD(iface, ThreadMgr, ITfThreadMgrEventSink_iface);
} }
static inline ThreadMgr *impl_from_ITfSourceSingleVtbl(ITfSourceSingle* iface) static inline ThreadMgr *impl_from_ITfSourceSingle(ITfSourceSingle *iface)
{ {
return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,SourceSingleVtbl)); return CONTAINING_RECORD(iface, ThreadMgr, ITfSourceSingle_iface);
}
static inline EnumTfDocumentMgr *impl_from_IEnumTfDocumentMgrs(IEnumTfDocumentMgrs *iface)
{
return CONTAINING_RECORD(iface, EnumTfDocumentMgr, IEnumTfDocumentMgrs_iface);
} }
static void free_sink(ThreadMgrSink *sink) static void free_sink(ThreadMgrSink *sink)
@ -245,28 +254,28 @@ static void ThreadMgr_Destructor(ThreadMgr *This)
static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, LPVOID *ppvOut)
{ {
ThreadMgr *This = (ThreadMgr *)iface; ThreadMgr *This = impl_from_ITfThreadMgr(iface);
*ppvOut = NULL; *ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfThreadMgr)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfThreadMgr))
{ {
*ppvOut = This; *ppvOut = &This->ITfThreadMgr_iface;
} }
else if (IsEqualIID(iid, &IID_ITfSource)) else if (IsEqualIID(iid, &IID_ITfSource))
{ {
*ppvOut = &This->SourceVtbl; *ppvOut = &This->ITfSource_iface;
} }
else if (IsEqualIID(iid, &IID_ITfKeystrokeMgr)) else if (IsEqualIID(iid, &IID_ITfKeystrokeMgr))
{ {
*ppvOut = &This->KeystrokeMgrVtbl; *ppvOut = &This->ITfKeystrokeMgr_iface;
} }
else if (IsEqualIID(iid, &IID_ITfMessagePump)) else if (IsEqualIID(iid, &IID_ITfMessagePump))
{ {
*ppvOut = &This->MessagePumpVtbl; *ppvOut = &This->ITfMessagePump_iface;
} }
else if (IsEqualIID(iid, &IID_ITfClientId)) else if (IsEqualIID(iid, &IID_ITfClientId))
{ {
*ppvOut = &This->ClientIdVtbl; *ppvOut = &This->ITfClientId_iface;
} }
else if (IsEqualIID(iid, &IID_ITfCompartmentMgr)) else if (IsEqualIID(iid, &IID_ITfCompartmentMgr))
{ {
@ -274,7 +283,7 @@ static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid,
} }
else if (IsEqualIID(iid, &IID_ITfSourceSingle)) else if (IsEqualIID(iid, &IID_ITfSourceSingle))
{ {
*ppvOut = &This->SourceSingleVtbl; *ppvOut = &This->ITfSourceSingle_iface;
} }
if (*ppvOut) if (*ppvOut)
@ -289,13 +298,13 @@ static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid,
static ULONG WINAPI ThreadMgr_AddRef(ITfThreadMgr *iface) static ULONG WINAPI ThreadMgr_AddRef(ITfThreadMgr *iface)
{ {
ThreadMgr *This = (ThreadMgr *)iface; ThreadMgr *This = impl_from_ITfThreadMgr(iface);
return InterlockedIncrement(&This->refCount); return InterlockedIncrement(&This->refCount);
} }
static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface) static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface)
{ {
ThreadMgr *This = (ThreadMgr *)iface; ThreadMgr *This = impl_from_ITfThreadMgr(iface);
ULONG ret; ULONG ret;
ret = InterlockedDecrement(&This->refCount); ret = InterlockedDecrement(&This->refCount);
@ -310,7 +319,7 @@ static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface)
static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *ptid) 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); TRACE("(%p) %p\n",This, ptid);
@ -321,7 +330,7 @@ static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *pti
{ {
GUID guid; GUID guid;
CoCreateGuid(&guid); CoCreateGuid(&guid);
ITfClientId_GetClientId((ITfClientId*)&This->ClientIdVtbl,&guid,&processId); ITfClientId_GetClientId(&This->ITfClientId_iface, &guid, &processId);
} }
activate_textservices(iface); activate_textservices(iface);
@ -332,7 +341,7 @@ static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *pti
static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface) static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface)
{ {
ThreadMgr *This = (ThreadMgr *)iface; ThreadMgr *This = impl_from_ITfThreadMgr(iface);
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
if (This->activationCount == 0) if (This->activationCount == 0)
@ -344,7 +353,7 @@ static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface)
{ {
if (This->focus) if (This->focus)
{ {
ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, 0, This->focus); ITfThreadMgrEventSink_OnSetFocus(&This->ITfThreadMgrEventSink_iface, 0, This->focus);
ITfDocumentMgr_Release(This->focus); ITfDocumentMgr_Release(This->focus);
This->focus = 0; This->focus = 0;
} }
@ -355,10 +364,9 @@ static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface)
return S_OK; return S_OK;
} }
static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocumentMgr static HRESULT WINAPI ThreadMgr_CreateDocumentMgr(ITfThreadMgr* iface, ITfDocumentMgr **ppdim)
**ppdim)
{ {
ThreadMgr *This = (ThreadMgr *)iface; ThreadMgr *This = impl_from_ITfThreadMgr(iface);
DocumentMgrEntry *mgrentry; DocumentMgrEntry *mgrentry;
HRESULT hr; HRESULT hr;
@ -367,7 +375,7 @@ static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocum
if (mgrentry == NULL) if (mgrentry == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hr = DocumentMgr_Constructor((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, ppdim); hr = DocumentMgr_Constructor(&This->ITfThreadMgrEventSink_iface, ppdim);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
@ -380,10 +388,9 @@ static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocum
return hr; return hr;
} }
static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDocumentMgrs static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDocumentMgrs **ppEnum)
**ppEnum)
{ {
ThreadMgr *This = (ThreadMgr *)iface; ThreadMgr *This = impl_from_ITfThreadMgr(iface);
TRACE("(%p) %p\n",This,ppEnum); TRACE("(%p) %p\n",This,ppEnum);
if (!ppEnum) if (!ppEnum)
@ -395,7 +402,7 @@ static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDo
static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr
**ppdimFocus) **ppdimFocus)
{ {
ThreadMgr *This = (ThreadMgr *)iface; ThreadMgr *This = impl_from_ITfThreadMgr(iface);
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
if (!ppdimFocus) if (!ppdimFocus)
@ -415,8 +422,8 @@ static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr
static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *pdimFocus) static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *pdimFocus)
{ {
ThreadMgr *This = impl_from_ITfThreadMgr(iface);
ITfDocumentMgr *check; ITfDocumentMgr *check;
ThreadMgr *This = (ThreadMgr *)iface;
TRACE("(%p) %p\n",This,pdimFocus); TRACE("(%p) %p\n",This,pdimFocus);
@ -425,7 +432,7 @@ static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *p
else if (FAILED(ITfDocumentMgr_QueryInterface(pdimFocus,&IID_ITfDocumentMgr,(LPVOID*) &check))) else if (FAILED(ITfDocumentMgr_QueryInterface(pdimFocus,&IID_ITfDocumentMgr,(LPVOID*) &check)))
return E_INVALIDARG; return E_INVALIDARG;
ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, check, This->focus); ITfThreadMgrEventSink_OnSetFocus(&This->ITfThreadMgrEventSink_iface, check, This->focus);
if (This->focus) if (This->focus)
ITfDocumentMgr_Release(This->focus); ITfDocumentMgr_Release(This->focus);
@ -489,8 +496,8 @@ static HRESULT SetupWindowsHook(ThreadMgr *This)
static HRESULT WINAPI ThreadMgr_AssociateFocus( ITfThreadMgr* iface, HWND hwnd, static HRESULT WINAPI ThreadMgr_AssociateFocus( ITfThreadMgr* iface, HWND hwnd,
ITfDocumentMgr *pdimNew, ITfDocumentMgr **ppdimPrev) ITfDocumentMgr *pdimNew, ITfDocumentMgr **ppdimPrev)
{ {
ThreadMgr *This = impl_from_ITfThreadMgr(iface);
struct list *cursor, *cursor2; struct list *cursor, *cursor2;
ThreadMgr *This = (ThreadMgr *)iface;
AssociatedWindow *wnd; AssociatedWindow *wnd;
TRACE("(%p) %p %p %p\n",This,hwnd,pdimNew,ppdimPrev); TRACE("(%p) %p %p %p\n",This,hwnd,pdimNew,ppdimPrev);
@ -530,8 +537,9 @@ ITfDocumentMgr *pdimNew, ITfDocumentMgr **ppdimPrev)
static HRESULT WINAPI ThreadMgr_IsThreadFocus( ITfThreadMgr* iface, BOOL *pfThreadFocus) static HRESULT WINAPI ThreadMgr_IsThreadFocus( ITfThreadMgr* iface, BOOL *pfThreadFocus)
{ {
ThreadMgr *This = impl_from_ITfThreadMgr(iface);
HWND focus; HWND focus;
ThreadMgr *This = (ThreadMgr *)iface;
TRACE("(%p) %p\n",This,pfThreadFocus); TRACE("(%p) %p\n",This,pfThreadFocus);
focus = GetFocus(); focus = GetFocus();
*pfThreadFocus = (focus == NULL); *pfThreadFocus = (focus == NULL);
@ -541,7 +549,7 @@ static HRESULT WINAPI ThreadMgr_IsThreadFocus( ITfThreadMgr* iface, BOOL *pfThre
static HRESULT WINAPI ThreadMgr_GetFunctionProvider( ITfThreadMgr* iface, REFCLSID clsid, static HRESULT WINAPI ThreadMgr_GetFunctionProvider( ITfThreadMgr* iface, REFCLSID clsid,
ITfFunctionProvider **ppFuncProv) ITfFunctionProvider **ppFuncProv)
{ {
ThreadMgr *This = (ThreadMgr *)iface; ThreadMgr *This = impl_from_ITfThreadMgr(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -549,7 +557,7 @@ ITfFunctionProvider **ppFuncProv)
static HRESULT WINAPI ThreadMgr_EnumFunctionProviders( ITfThreadMgr* iface, static HRESULT WINAPI ThreadMgr_EnumFunctionProviders( ITfThreadMgr* iface,
IEnumTfFunctionProviders **ppEnum) IEnumTfFunctionProviders **ppEnum)
{ {
ThreadMgr *This = (ThreadMgr *)iface; ThreadMgr *This = impl_from_ITfThreadMgr(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -557,7 +565,7 @@ IEnumTfFunctionProviders **ppEnum)
static HRESULT WINAPI ThreadMgr_GetGlobalCompartment( ITfThreadMgr* iface, static HRESULT WINAPI ThreadMgr_GetGlobalCompartment( ITfThreadMgr* iface,
ITfCompartmentMgr **ppCompMgr) ITfCompartmentMgr **ppCompMgr)
{ {
ThreadMgr *This = (ThreadMgr *)iface; ThreadMgr *This = impl_from_ITfThreadMgr(iface);
HRESULT hr; HRESULT hr;
TRACE("(%p) %p\n",This, ppCompMgr); TRACE("(%p) %p\n",This, ppCompMgr);
@ -576,12 +584,11 @@ ITfCompartmentMgr **ppCompMgr)
return S_OK; return S_OK;
} }
static const ITfThreadMgrVtbl ThreadMgr_ThreadMgrVtbl = static const ITfThreadMgrVtbl ThreadMgrVtbl =
{ {
ThreadMgr_QueryInterface, ThreadMgr_QueryInterface,
ThreadMgr_AddRef, ThreadMgr_AddRef,
ThreadMgr_Release, ThreadMgr_Release,
ThreadMgr_fnActivate, ThreadMgr_fnActivate,
ThreadMgr_fnDeactivate, ThreadMgr_fnDeactivate,
ThreadMgr_CreateDocumentMgr, ThreadMgr_CreateDocumentMgr,
@ -595,23 +602,22 @@ static const ITfThreadMgrVtbl ThreadMgr_ThreadMgrVtbl =
ThreadMgr_GetGlobalCompartment ThreadMgr_GetGlobalCompartment
}; };
static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut)
{ {
ThreadMgr *This = impl_from_ITfSourceVtbl(iface); ThreadMgr *This = impl_from_ITfSource(iface);
return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, *ppvOut);
} }
static ULONG WINAPI Source_AddRef(ITfSource *iface) static ULONG WINAPI Source_AddRef(ITfSource *iface)
{ {
ThreadMgr *This = impl_from_ITfSourceVtbl(iface); ThreadMgr *This = impl_from_ITfSource(iface);
return ThreadMgr_AddRef((ITfThreadMgr*)This); return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface);
} }
static ULONG WINAPI Source_Release(ITfSource *iface) static ULONG WINAPI Source_Release(ITfSource *iface)
{ {
ThreadMgr *This = impl_from_ITfSourceVtbl(iface); ThreadMgr *This = impl_from_ITfSource(iface);
return ThreadMgr_Release((ITfThreadMgr *)This); return ITfThreadMgr_Release(&This->ITfThreadMgr_iface);
} }
/***************************************************** /*****************************************************
@ -620,8 +626,8 @@ static ULONG WINAPI Source_Release(ITfSource *iface)
static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface, static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface,
REFIID riid, IUnknown *punk, DWORD *pdwCookie) REFIID riid, IUnknown *punk, DWORD *pdwCookie)
{ {
ThreadMgr *This = impl_from_ITfSource(iface);
ThreadMgrSink *tms; ThreadMgrSink *tms;
ThreadMgr *This = impl_from_ITfSourceVtbl(iface);
TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
@ -654,8 +660,8 @@ static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface,
static HRESULT WINAPI ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) static HRESULT WINAPI ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
{ {
ThreadMgr *This = impl_from_ITfSource(iface);
ThreadMgrSink *sink; ThreadMgrSink *sink;
ThreadMgr *This = impl_from_ITfSourceVtbl(iface);
TRACE("(%p) %x\n",This,pdwCookie); TRACE("(%p) %x\n",This,pdwCookie);
@ -672,12 +678,11 @@ static HRESULT WINAPI ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCo
return S_OK; return S_OK;
} }
static const ITfSourceVtbl ThreadMgr_SourceVtbl = static const ITfSourceVtbl ThreadMgrSourceVtbl =
{ {
Source_QueryInterface, Source_QueryInterface,
Source_AddRef, Source_AddRef,
Source_Release, Source_Release,
ThreadMgrSource_AdviseSink, ThreadMgrSource_AdviseSink,
ThreadMgrSource_UnadviseSink, ThreadMgrSource_UnadviseSink,
}; };
@ -688,26 +693,26 @@ static const ITfSourceVtbl ThreadMgr_SourceVtbl =
static HRESULT WINAPI KeystrokeMgr_QueryInterface(ITfKeystrokeMgr *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI KeystrokeMgr_QueryInterface(ITfKeystrokeMgr *iface, REFIID iid, LPVOID *ppvOut)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, *ppvOut);
} }
static ULONG WINAPI KeystrokeMgr_AddRef(ITfKeystrokeMgr *iface) static ULONG WINAPI KeystrokeMgr_AddRef(ITfKeystrokeMgr *iface)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
return ThreadMgr_AddRef((ITfThreadMgr*)This); return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface);
} }
static ULONG WINAPI KeystrokeMgr_Release(ITfKeystrokeMgr *iface) static ULONG WINAPI KeystrokeMgr_Release(ITfKeystrokeMgr *iface)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
return ThreadMgr_Release((ITfThreadMgr *)This); return ITfThreadMgr_Release(&This->ITfThreadMgr_iface);
} }
static HRESULT WINAPI KeystrokeMgr_AdviseKeyEventSink(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_AdviseKeyEventSink(ITfKeystrokeMgr *iface,
TfClientId tid, ITfKeyEventSink *pSink, BOOL fForeground) TfClientId tid, ITfKeyEventSink *pSink, BOOL fForeground)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
CLSID textservice; CLSID textservice;
ITfKeyEventSink *check = NULL; ITfKeyEventSink *check = NULL;
@ -747,7 +752,7 @@ static HRESULT WINAPI KeystrokeMgr_AdviseKeyEventSink(ITfKeystrokeMgr *iface,
static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface,
TfClientId tid) TfClientId tid)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
CLSID textservice; CLSID textservice;
ITfKeyEventSink *check = NULL; ITfKeyEventSink *check = NULL;
TRACE("(%p) %x\n",This,tid); TRACE("(%p) %x\n",This,tid);
@ -779,7 +784,7 @@ static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface,
static HRESULT WINAPI KeystrokeMgr_GetForeground(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_GetForeground(ITfKeystrokeMgr *iface,
CLSID *pclsid) CLSID *pclsid)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
TRACE("(%p) %p\n",This,pclsid); TRACE("(%p) %p\n",This,pclsid);
if (!pclsid) if (!pclsid)
return E_INVALIDARG; return E_INVALIDARG;
@ -794,7 +799,7 @@ static HRESULT WINAPI KeystrokeMgr_GetForeground(ITfKeystrokeMgr *iface,
static HRESULT WINAPI KeystrokeMgr_TestKeyDown(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_TestKeyDown(ITfKeystrokeMgr *iface,
WPARAM wParam, LPARAM lParam, BOOL *pfEaten) WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -802,7 +807,7 @@ static HRESULT WINAPI KeystrokeMgr_TestKeyDown(ITfKeystrokeMgr *iface,
static HRESULT WINAPI KeystrokeMgr_TestKeyUp(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_TestKeyUp(ITfKeystrokeMgr *iface,
WPARAM wParam, LPARAM lParam, BOOL *pfEaten) WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -810,7 +815,7 @@ static HRESULT WINAPI KeystrokeMgr_TestKeyUp(ITfKeystrokeMgr *iface,
static HRESULT WINAPI KeystrokeMgr_KeyDown(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_KeyDown(ITfKeystrokeMgr *iface,
WPARAM wParam, LPARAM lParam, BOOL *pfEaten) WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -818,7 +823,7 @@ static HRESULT WINAPI KeystrokeMgr_KeyDown(ITfKeystrokeMgr *iface,
static HRESULT WINAPI KeystrokeMgr_KeyUp(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_KeyUp(ITfKeystrokeMgr *iface,
WPARAM wParam, LPARAM lParam, BOOL *pfEaten) WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -826,7 +831,7 @@ static HRESULT WINAPI KeystrokeMgr_KeyUp(ITfKeystrokeMgr *iface,
static HRESULT WINAPI KeystrokeMgr_GetPreservedKey(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_GetPreservedKey(ITfKeystrokeMgr *iface,
ITfContext *pic, const TF_PRESERVEDKEY *pprekey, GUID *pguid) 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); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -834,7 +839,7 @@ static HRESULT WINAPI KeystrokeMgr_GetPreservedKey(ITfKeystrokeMgr *iface,
static HRESULT WINAPI KeystrokeMgr_IsPreservedKey(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_IsPreservedKey(ITfKeystrokeMgr *iface,
REFGUID rguid, const TF_PRESERVEDKEY *pprekey, BOOL *pfRegistered) REFGUID rguid, const TF_PRESERVEDKEY *pprekey, BOOL *pfRegistered)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
struct list *cursor; struct list *cursor;
TRACE("(%p) %s (%x %x) %p\n",This,debugstr_guid(rguid), (pprekey)?pprekey->uVKey:0, (pprekey)?pprekey->uModifiers:0, pfRegistered); TRACE("(%p) %s (%x %x) %p\n",This,debugstr_guid(rguid), (pprekey)?pprekey->uVKey:0, (pprekey)?pprekey->uModifiers:0, pfRegistered);
@ -860,7 +865,7 @@ static HRESULT WINAPI KeystrokeMgr_PreserveKey(ITfKeystrokeMgr *iface,
TfClientId tid, REFGUID rguid, const TF_PRESERVEDKEY *prekey, TfClientId tid, REFGUID rguid, const TF_PRESERVEDKEY *prekey,
const WCHAR *pchDesc, ULONG cchDesc) const WCHAR *pchDesc, ULONG cchDesc)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
struct list *cursor; struct list *cursor;
PreservedKey *newkey; PreservedKey *newkey;
@ -903,7 +908,7 @@ static HRESULT WINAPI KeystrokeMgr_PreserveKey(ITfKeystrokeMgr *iface,
static HRESULT WINAPI KeystrokeMgr_UnpreserveKey(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_UnpreserveKey(ITfKeystrokeMgr *iface,
REFGUID rguid, const TF_PRESERVEDKEY *pprekey) REFGUID rguid, const TF_PRESERVEDKEY *pprekey)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
PreservedKey* key = NULL; PreservedKey* key = NULL;
struct list *cursor; struct list *cursor;
TRACE("(%p) %s (%x %x)\n",This,debugstr_guid(rguid),(pprekey)?pprekey->uVKey:0, (pprekey)?pprekey->uModifiers:0); TRACE("(%p) %s (%x %x)\n",This,debugstr_guid(rguid),(pprekey)?pprekey->uVKey:0, (pprekey)?pprekey->uModifiers:0);
@ -932,7 +937,7 @@ static HRESULT WINAPI KeystrokeMgr_UnpreserveKey(ITfKeystrokeMgr *iface,
static HRESULT WINAPI KeystrokeMgr_SetPreservedKeyDescription(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_SetPreservedKeyDescription(ITfKeystrokeMgr *iface,
REFGUID rguid, const WCHAR *pchDesc, ULONG cchDesc) REFGUID rguid, const WCHAR *pchDesc, ULONG cchDesc)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -940,7 +945,7 @@ static HRESULT WINAPI KeystrokeMgr_SetPreservedKeyDescription(ITfKeystrokeMgr *i
static HRESULT WINAPI KeystrokeMgr_GetPreservedKeyDescription(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_GetPreservedKeyDescription(ITfKeystrokeMgr *iface,
REFGUID rguid, BSTR *pbstrDesc) REFGUID rguid, BSTR *pbstrDesc)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -948,17 +953,16 @@ static HRESULT WINAPI KeystrokeMgr_GetPreservedKeyDescription(ITfKeystrokeMgr *i
static HRESULT WINAPI KeystrokeMgr_SimulatePreservedKey(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_SimulatePreservedKey(ITfKeystrokeMgr *iface,
ITfContext *pic, REFGUID rguid, BOOL *pfEaten) ITfContext *pic, REFGUID rguid, BOOL *pfEaten)
{ {
ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface);
FIXME("STUB:(%p)\n",This); FIXME("STUB:(%p)\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static const ITfKeystrokeMgrVtbl ThreadMgr_KeystrokeMgrVtbl = static const ITfKeystrokeMgrVtbl KeystrokeMgrVtbl =
{ {
KeystrokeMgr_QueryInterface, KeystrokeMgr_QueryInterface,
KeystrokeMgr_AddRef, KeystrokeMgr_AddRef,
KeystrokeMgr_Release, KeystrokeMgr_Release,
KeystrokeMgr_AdviseKeyEventSink, KeystrokeMgr_AdviseKeyEventSink,
KeystrokeMgr_UnadviseKeyEventSink, KeystrokeMgr_UnadviseKeyEventSink,
KeystrokeMgr_GetForeground, KeystrokeMgr_GetForeground,
@ -981,20 +985,20 @@ static const ITfKeystrokeMgrVtbl ThreadMgr_KeystrokeMgrVtbl =
static HRESULT WINAPI MessagePump_QueryInterface(ITfMessagePump *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI MessagePump_QueryInterface(ITfMessagePump *iface, REFIID iid, LPVOID *ppvOut)
{ {
ThreadMgr *This = impl_from_ITfMessagePumpVtbl(iface); ThreadMgr *This = impl_from_ITfMessagePump(iface);
return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, *ppvOut);
} }
static ULONG WINAPI MessagePump_AddRef(ITfMessagePump *iface) static ULONG WINAPI MessagePump_AddRef(ITfMessagePump *iface)
{ {
ThreadMgr *This = impl_from_ITfMessagePumpVtbl(iface); ThreadMgr *This = impl_from_ITfMessagePump(iface);
return ThreadMgr_AddRef((ITfThreadMgr*)This); return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface);
} }
static ULONG WINAPI MessagePump_Release(ITfMessagePump *iface) static ULONG WINAPI MessagePump_Release(ITfMessagePump *iface)
{ {
ThreadMgr *This = impl_from_ITfMessagePumpVtbl(iface); ThreadMgr *This = impl_from_ITfMessagePump(iface);
return ThreadMgr_Release((ITfThreadMgr *)This); return ITfThreadMgr_Release(&This->ITfThreadMgr_iface);
} }
static HRESULT WINAPI MessagePump_PeekMessageA(ITfMessagePump *iface, static HRESULT WINAPI MessagePump_PeekMessageA(ITfMessagePump *iface,
@ -1037,12 +1041,11 @@ static HRESULT WINAPI MessagePump_GetMessageW(ITfMessagePump *iface,
return S_OK; return S_OK;
} }
static const ITfMessagePumpVtbl ThreadMgr_MessagePumpVtbl = static const ITfMessagePumpVtbl MessagePumpVtbl =
{ {
MessagePump_QueryInterface, MessagePump_QueryInterface,
MessagePump_AddRef, MessagePump_AddRef,
MessagePump_Release, MessagePump_Release,
MessagePump_PeekMessageA, MessagePump_PeekMessageA,
MessagePump_GetMessageA, MessagePump_GetMessageA,
MessagePump_PeekMessageW, MessagePump_PeekMessageW,
@ -1055,29 +1058,29 @@ static const ITfMessagePumpVtbl ThreadMgr_MessagePumpVtbl =
static HRESULT WINAPI ClientId_QueryInterface(ITfClientId *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI ClientId_QueryInterface(ITfClientId *iface, REFIID iid, LPVOID *ppvOut)
{ {
ThreadMgr *This = impl_from_ITfClientIdVtbl(iface); ThreadMgr *This = impl_from_ITfClientId(iface);
return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, *ppvOut);
} }
static ULONG WINAPI ClientId_AddRef(ITfClientId *iface) static ULONG WINAPI ClientId_AddRef(ITfClientId *iface)
{ {
ThreadMgr *This = impl_from_ITfClientIdVtbl(iface); ThreadMgr *This = impl_from_ITfClientId(iface);
return ThreadMgr_AddRef((ITfThreadMgr*)This); return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface);
} }
static ULONG WINAPI ClientId_Release(ITfClientId *iface) static ULONG WINAPI ClientId_Release(ITfClientId *iface)
{ {
ThreadMgr *This = impl_from_ITfClientIdVtbl(iface); ThreadMgr *This = impl_from_ITfClientId(iface);
return ThreadMgr_Release((ITfThreadMgr *)This); return ITfThreadMgr_Release(&This->ITfThreadMgr_iface);
} }
static HRESULT WINAPI ClientId_GetClientId(ITfClientId *iface, static HRESULT WINAPI ClientId_GetClientId(ITfClientId *iface,
REFCLSID rclsid, TfClientId *ptid) REFCLSID rclsid, TfClientId *ptid)
{ {
ThreadMgr *This = impl_from_ITfClientId(iface);
HRESULT hr; HRESULT hr;
ITfCategoryMgr *catmgr; ITfCategoryMgr *catmgr;
ThreadMgr *This = impl_from_ITfClientIdVtbl(iface);
TRACE("(%p) %s\n",This,debugstr_guid(rclsid)); TRACE("(%p) %s\n",This,debugstr_guid(rclsid));
@ -1088,12 +1091,11 @@ static HRESULT WINAPI ClientId_GetClientId(ITfClientId *iface,
return hr; return hr;
} }
static const ITfClientIdVtbl ThreadMgr_ClientIdVtbl = static const ITfClientIdVtbl ClientIdVtbl =
{ {
ClientId_QueryInterface, ClientId_QueryInterface,
ClientId_AddRef, ClientId_AddRef,
ClientId_Release, ClientId_Release,
ClientId_GetClientId ClientId_GetClientId
}; };
@ -1103,19 +1105,19 @@ static const ITfClientIdVtbl ThreadMgr_ClientIdVtbl =
static HRESULT WINAPI ThreadMgrEventSink_QueryInterface(ITfThreadMgrEventSink *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI ThreadMgrEventSink_QueryInterface(ITfThreadMgrEventSink *iface, REFIID iid, LPVOID *ppvOut)
{ {
ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); 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) static ULONG WINAPI ThreadMgrEventSink_AddRef(ITfThreadMgrEventSink *iface)
{ {
ThreadMgr *This = impl_from_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) static ULONG WINAPI ThreadMgrEventSink_Release(ITfThreadMgrEventSink *iface)
{ {
ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface);
return ThreadMgr_Release((ITfThreadMgr *)This); return ITfThreadMgr_Release(&This->ITfThreadMgr_iface);
} }
@ -1205,12 +1207,11 @@ static HRESULT WINAPI ThreadMgrEventSink_OnPopContext(
return S_OK; return S_OK;
} }
static const ITfThreadMgrEventSinkVtbl ThreadMgr_ThreadMgrEventSinkVtbl = static const ITfThreadMgrEventSinkVtbl ThreadMgrEventSinkVtbl =
{ {
ThreadMgrEventSink_QueryInterface, ThreadMgrEventSink_QueryInterface,
ThreadMgrEventSink_AddRef, ThreadMgrEventSink_AddRef,
ThreadMgrEventSink_Release, ThreadMgrEventSink_Release,
ThreadMgrEventSink_OnInitDocumentMgr, ThreadMgrEventSink_OnInitDocumentMgr,
ThreadMgrEventSink_OnUninitDocumentMgr, ThreadMgrEventSink_OnUninitDocumentMgr,
ThreadMgrEventSink_OnSetFocus, ThreadMgrEventSink_OnSetFocus,
@ -1223,26 +1224,26 @@ static const ITfThreadMgrEventSinkVtbl ThreadMgr_ThreadMgrEventSinkVtbl =
*****************************************************/ *****************************************************/
static HRESULT WINAPI ThreadMgrSourceSingle_QueryInterface(ITfSourceSingle *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI ThreadMgrSourceSingle_QueryInterface(ITfSourceSingle *iface, REFIID iid, LPVOID *ppvOut)
{ {
ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); ThreadMgr *This = impl_from_ITfSourceSingle(iface);
return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, *ppvOut);
} }
static ULONG WINAPI ThreadMgrSourceSingle_AddRef(ITfSourceSingle *iface) static ULONG WINAPI ThreadMgrSourceSingle_AddRef(ITfSourceSingle *iface)
{ {
ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); ThreadMgr *This = impl_from_ITfSourceSingle(iface);
return ThreadMgr_AddRef((ITfThreadMgr *)This); return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface);
} }
static ULONG WINAPI ThreadMgrSourceSingle_Release(ITfSourceSingle *iface) static ULONG WINAPI ThreadMgrSourceSingle_Release(ITfSourceSingle *iface)
{ {
ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); ThreadMgr *This = impl_from_ITfSourceSingle(iface);
return ThreadMgr_Release((ITfThreadMgr *)This); return ITfThreadMgr_Release(&This->ITfThreadMgr_iface);
} }
static HRESULT WINAPI ThreadMgrSourceSingle_AdviseSingleSink( ITfSourceSingle *iface, static HRESULT WINAPI ThreadMgrSourceSingle_AdviseSingleSink( ITfSourceSingle *iface,
TfClientId tid, REFIID riid, IUnknown *punk) 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); FIXME("STUB:(%p) %i %s %p\n",This, tid, debugstr_guid(riid),punk);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -1250,19 +1251,18 @@ static HRESULT WINAPI ThreadMgrSourceSingle_AdviseSingleSink( ITfSourceSingle *i
static HRESULT WINAPI ThreadMgrSourceSingle_UnadviseSingleSink( ITfSourceSingle *iface, static HRESULT WINAPI ThreadMgrSourceSingle_UnadviseSingleSink( ITfSourceSingle *iface,
TfClientId tid, REFIID riid) 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)); FIXME("STUB:(%p) %i %s\n",This, tid, debugstr_guid(riid));
return E_NOTIMPL; return E_NOTIMPL;
} }
static const ITfSourceSingleVtbl ThreadMgr_SourceSingleVtbl = static const ITfSourceSingleVtbl SourceSingleVtbl =
{ {
ThreadMgrSourceSingle_QueryInterface, ThreadMgrSourceSingle_QueryInterface,
ThreadMgrSourceSingle_AddRef, ThreadMgrSourceSingle_AddRef,
ThreadMgrSourceSingle_Release, ThreadMgrSourceSingle_Release,
ThreadMgrSourceSingle_AdviseSingleSink, ThreadMgrSourceSingle_AdviseSingleSink,
ThreadMgrSourceSingle_UnadviseSingleSink, ThreadMgrSourceSingle_UnadviseSingleSink
}; };
HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
@ -1275,8 +1275,8 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
This = TlsGetValue(tlsIndex); This = TlsGetValue(tlsIndex);
if (This) if (This)
{ {
ThreadMgr_AddRef((ITfThreadMgr*)This); ThreadMgr_AddRef(&This->ITfThreadMgr_iface);
*ppOut = (IUnknown*)This; *ppOut = (IUnknown*)&This->ITfThreadMgr_iface;
return S_OK; return S_OK;
} }
@ -1284,13 +1284,13 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
if (This == NULL) if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->ThreadMgrVtbl= &ThreadMgr_ThreadMgrVtbl; This->ITfThreadMgr_iface.lpVtbl= &ThreadMgrVtbl;
This->SourceVtbl = &ThreadMgr_SourceVtbl; This->ITfSource_iface.lpVtbl = &ThreadMgrSourceVtbl;
This->KeystrokeMgrVtbl= &ThreadMgr_KeystrokeMgrVtbl; This->ITfKeystrokeMgr_iface.lpVtbl= &KeystrokeMgrVtbl;
This->MessagePumpVtbl= &ThreadMgr_MessagePumpVtbl; This->ITfMessagePump_iface.lpVtbl = &MessagePumpVtbl;
This->ClientIdVtbl = &ThreadMgr_ClientIdVtbl; This->ITfClientId_iface.lpVtbl = &ClientIdVtbl;
This->ThreadMgrEventSinkVtbl = &ThreadMgr_ThreadMgrEventSinkVtbl; This->ITfThreadMgrEventSink_iface.lpVtbl = &ThreadMgrEventSinkVtbl;
This->SourceSingleVtbl = &ThreadMgr_SourceSingleVtbl; This->ITfSourceSingle_iface.lpVtbl = &SourceSingleVtbl;
This->refCount = 1; This->refCount = 1;
TlsSetValue(tlsIndex,This); TlsSetValue(tlsIndex,This);
@ -1308,7 +1308,7 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
list_init(&This->ThreadMgrEventSink); list_init(&This->ThreadMgrEventSink);
TRACE("returning %p\n", This); TRACE("returning %p\n", This);
*ppOut = (IUnknown *)This; *ppOut = (IUnknown *)&This->ITfThreadMgr_iface;
return S_OK; return S_OK;
} }
@ -1323,12 +1323,12 @@ static void EnumTfDocumentMgr_Destructor(EnumTfDocumentMgr *This)
static HRESULT WINAPI EnumTfDocumentMgr_QueryInterface(IEnumTfDocumentMgrs *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI EnumTfDocumentMgr_QueryInterface(IEnumTfDocumentMgrs *iface, REFIID iid, LPVOID *ppvOut)
{ {
EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface);
*ppvOut = NULL; *ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfDocumentMgrs)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfDocumentMgrs))
{ {
*ppvOut = This; *ppvOut = &This->IEnumTfDocumentMgrs_iface;
} }
if (*ppvOut) if (*ppvOut)
@ -1343,13 +1343,13 @@ static HRESULT WINAPI EnumTfDocumentMgr_QueryInterface(IEnumTfDocumentMgrs *ifac
static ULONG WINAPI EnumTfDocumentMgr_AddRef(IEnumTfDocumentMgrs *iface) static ULONG WINAPI EnumTfDocumentMgr_AddRef(IEnumTfDocumentMgrs *iface)
{ {
EnumTfDocumentMgr *This = (EnumTfDocumentMgr*)iface; EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface);
return InterlockedIncrement(&This->refCount); return InterlockedIncrement(&This->refCount);
} }
static ULONG WINAPI EnumTfDocumentMgr_Release(IEnumTfDocumentMgrs *iface) static ULONG WINAPI EnumTfDocumentMgr_Release(IEnumTfDocumentMgrs *iface)
{ {
EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface);
ULONG ret; ULONG ret;
ret = InterlockedDecrement(&This->refCount); ret = InterlockedDecrement(&This->refCount);
@ -1361,7 +1361,7 @@ static ULONG WINAPI EnumTfDocumentMgr_Release(IEnumTfDocumentMgrs *iface)
static HRESULT WINAPI EnumTfDocumentMgr_Next(IEnumTfDocumentMgrs *iface, static HRESULT WINAPI EnumTfDocumentMgr_Next(IEnumTfDocumentMgrs *iface,
ULONG ulCount, ITfDocumentMgr **rgDocumentMgr, ULONG *pcFetched) ULONG ulCount, ITfDocumentMgr **rgDocumentMgr, ULONG *pcFetched)
{ {
EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface);
ULONG fetched = 0; ULONG fetched = 0;
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
@ -1392,8 +1392,9 @@ static HRESULT WINAPI EnumTfDocumentMgr_Next(IEnumTfDocumentMgrs *iface,
static HRESULT WINAPI EnumTfDocumentMgr_Skip( IEnumTfDocumentMgrs* iface, ULONG celt) static HRESULT WINAPI EnumTfDocumentMgr_Skip( IEnumTfDocumentMgrs* iface, ULONG celt)
{ {
EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface);
ULONG i; ULONG i;
EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface;
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
for(i = 0; i < celt && This->index != NULL; i++) for(i = 0; i < celt && This->index != NULL; i++)
This->index = list_next(This->head, This->index); This->index = list_next(This->head, This->index);
@ -1402,7 +1403,7 @@ static HRESULT WINAPI EnumTfDocumentMgr_Skip( IEnumTfDocumentMgrs* iface, ULONG
static HRESULT WINAPI EnumTfDocumentMgr_Reset( IEnumTfDocumentMgrs* iface) static HRESULT WINAPI EnumTfDocumentMgr_Reset( IEnumTfDocumentMgrs* iface)
{ {
EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface);
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
This->index = list_head(This->head); This->index = list_head(This->head);
return S_OK; return S_OK;
@ -1411,7 +1412,7 @@ static HRESULT WINAPI EnumTfDocumentMgr_Reset( IEnumTfDocumentMgrs* iface)
static HRESULT WINAPI EnumTfDocumentMgr_Clone( IEnumTfDocumentMgrs *iface, static HRESULT WINAPI EnumTfDocumentMgr_Clone( IEnumTfDocumentMgrs *iface,
IEnumTfDocumentMgrs **ppenum) IEnumTfDocumentMgrs **ppenum)
{ {
EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface);
HRESULT res; HRESULT res;
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
@ -1421,17 +1422,17 @@ static HRESULT WINAPI EnumTfDocumentMgr_Clone( IEnumTfDocumentMgrs *iface,
res = EnumTfDocumentMgr_Constructor(This->head, ppenum); res = EnumTfDocumentMgr_Constructor(This->head, ppenum);
if (SUCCEEDED(res)) if (SUCCEEDED(res))
{ {
EnumTfDocumentMgr *new_This = (EnumTfDocumentMgr *)*ppenum; EnumTfDocumentMgr *new_This = impl_from_IEnumTfDocumentMgrs(*ppenum);
new_This->index = This->index; new_This->index = This->index;
} }
return res; return res;
} }
static const IEnumTfDocumentMgrsVtbl IEnumTfDocumentMgrs_Vtbl ={ static const IEnumTfDocumentMgrsVtbl EnumTfDocumentMgrsVtbl =
{
EnumTfDocumentMgr_QueryInterface, EnumTfDocumentMgr_QueryInterface,
EnumTfDocumentMgr_AddRef, EnumTfDocumentMgr_AddRef,
EnumTfDocumentMgr_Release, EnumTfDocumentMgr_Release,
EnumTfDocumentMgr_Clone, EnumTfDocumentMgr_Clone,
EnumTfDocumentMgr_Next, EnumTfDocumentMgr_Next,
EnumTfDocumentMgr_Reset, EnumTfDocumentMgr_Reset,
@ -1446,7 +1447,7 @@ static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentM
if (This == NULL) if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->Vtbl= &IEnumTfDocumentMgrs_Vtbl; This->IEnumTfDocumentMgrs_iface.lpVtbl= &EnumTfDocumentMgrsVtbl;
This->refCount = 1; This->refCount = 1;
This->head = head; This->head = head;
This->index = list_head(This->head); This->index = list_head(This->head);
@ -1456,9 +1457,9 @@ static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentM
return S_OK; 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; struct list *cursor;
LIST_FOR_EACH(cursor, &This->CreatedDocumentMgrs) LIST_FOR_EACH(cursor, &This->CreatedDocumentMgrs)
{ {