Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/msctf/range.c | 19 +++++++++++++------ dlls/msctf/tests/inputprocessor.c | 26 +++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/dlls/msctf/range.c b/dlls/msctf/range.c index c4eee2501fb..85922791bad 100644 --- a/dlls/msctf/range.c +++ b/dlls/msctf/range.c @@ -42,7 +42,7 @@ typedef struct tagRange { LONG refCount;
ITextStoreACP *pITextStoreACP; - ITfContext *pITfContext; + ITfContext *context;
DWORD lockType; TfGravity gravityStart, gravityEnd; @@ -58,6 +58,7 @@ static inline Range *impl_from_ITfRange(ITfRange *iface) static void Range_Destructor(Range *This) { TRACE("destroying %p\n", This); + ITfContext_Release(This->context); HeapFree(GetProcessHeap(),0,This); }
@@ -282,13 +283,18 @@ static HRESULT WINAPI Range_Clone(ITfRange *iface, ITfRange **ppClone) return E_NOTIMPL; }
-static HRESULT WINAPI Range_GetContext(ITfRange *iface, ITfContext **ppContext) +static HRESULT WINAPI Range_GetContext(ITfRange *iface, ITfContext **context) { Range *This = impl_from_ITfRange(iface); - TRACE("(%p)\n",This); - if (!ppContext) + + TRACE("(%p, %p)\n", This, context); + + if (!context) return E_INVALIDARG; - *ppContext = This->pITfContext; + + *context = This->context; + ITfContext_AddRef(*context); + return S_OK; }
@@ -334,7 +340,8 @@ HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD l
This->ITfRange_iface.lpVtbl = &Range_RangeVtbl; This->refCount = 1; - This->pITfContext = context; + This->context = context; + ITfContext_AddRef(This->context); This->pITextStoreACP = textstore; This->lockType = lockType; This->anchorStart = anchorStart; diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c index 55a6ab6c34c..fd03059e545 100644 --- a/dlls/msctf/tests/inputprocessor.c +++ b/dlls/msctf/tests/inputprocessor.c @@ -228,6 +228,8 @@ static HRESULT WINAPI TextStoreACP_AdviseSink(ITextStoreACP *iface, REFIID riid, IUnknown *punk, DWORD dwMask) { ITextStoreACPServices *services; + ITfRangeACP *range; + ITfContext *context; HRESULT hr;
if (winetest_debug > 1) trace("ITextStoreACP::AdviseSink(iid %s, mask %#x)\n", @@ -243,6 +245,18 @@ static HRESULT WINAPI TextStoreACP_AdviseSink(ITextStoreACP *iface,
hr = ITextStoreACPSink_QueryInterface(ACPSink, &IID_ITextStoreACPServices, (void**)&services); ok(hr == S_OK, "got 0x%08x\n", hr); + + range = NULL; + hr = ITextStoreACPServices_CreateRange(services, 0, 1, &range); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + if (range) + { + hr = ITfRangeACP_GetContext(range, &context); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ITfContext_Release(context); + ITfRangeACP_Release(range); + } + ITextStoreACPServices_Release(services);
return S_OK; @@ -2084,10 +2098,11 @@ static void test_InsertAtSelection(TfEditCookie ec, ITfContext *cxt) static HRESULT WINAPI EditSession_DoEditSession(ITfEditSession *iface, TfEditCookie ec) { - ITfContext *cxt; + ITfContext *cxt, *context2; ITfDocumentMgr *dm; ITfRange *range; TF_SELECTION selection; + IUnknown *unk; ULONG fetched; HRESULT hr;
@@ -2109,6 +2124,15 @@ TfEditCookie ec) ok(SUCCEEDED(hr),"Unexpected return code %x\n",hr); ok(range != NULL,"Range set to NULL\n");
+ hr = ITfRange_GetContext(range, &context2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(context2 == cxt, "Unexpected context pointer.\n"); + ITfContext_Release(context2); + + hr = ITfRange_QueryInterface(range, &IID_ITfRangeACP, (void **)&unk); +todo_wine + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ITfRange_Release(range);
hr = ITfContext_GetEnd(cxt,ec,NULL);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/msctf/context.c | 16 +++++----------- dlls/msctf/msctf_internal.h | 2 +- dlls/msctf/range.c | 8 ++------ 3 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c index 63f2bf5455d..9eb61efa411 100644 --- a/dlls/msctf/context.c +++ b/dlls/msctf/context.c @@ -267,7 +267,6 @@ static HRESULT WINAPI Context_GetSelection (ITfContext *iface, TF_SELECTION *pSelection, ULONG *pcFetched) { Context *This = impl_from_ITfContext(iface); - EditCookie *cookie; ULONG count, i; ULONG totalFetched = 0; HRESULT hr = S_OK; @@ -289,8 +288,6 @@ static HRESULT WINAPI Context_GetSelection (ITfContext *iface, return E_NOTIMPL; }
- cookie = get_Cookie_data(ec); - if (ulIndex == TF_DEFAULT_SELECTION) count = 1; else @@ -310,7 +307,7 @@ static HRESULT WINAPI Context_GetSelection (ITfContext *iface, { pSelection[totalFetched].style.ase = acps.style.ase; pSelection[totalFetched].style.fInterimChar = acps.style.fInterimChar; - Range_Constructor(iface, This->pITextStoreACP, cookie->lockType, acps.acpStart, acps.acpEnd, &pSelection[totalFetched].range); + Range_Constructor(iface, acps.acpStart, acps.acpEnd, &pSelection[totalFetched].range); totalFetched ++; } else @@ -364,7 +361,7 @@ static HRESULT WINAPI Context_GetStart (ITfContext *iface, TfEditCookie ec, ITfRange **ppStart) { Context *This = impl_from_ITfContext(iface); - EditCookie *cookie; + TRACE("(%p) %i %p\n",This,ec,ppStart);
if (!ppStart) @@ -378,15 +375,13 @@ static HRESULT WINAPI Context_GetStart (ITfContext *iface, if (get_Cookie_magic(ec)!=COOKIE_MAGIC_EDITCOOKIE) return TF_E_NOLOCK;
- cookie = get_Cookie_data(ec); - return Range_Constructor(iface, This->pITextStoreACP, cookie->lockType, 0, 0, ppStart); + return Range_Constructor(iface, 0, 0, ppStart); }
static HRESULT WINAPI Context_GetEnd (ITfContext *iface, TfEditCookie ec, ITfRange **ppEnd) { Context *This = impl_from_ITfContext(iface); - EditCookie *cookie; LONG end; TRACE("(%p) %i %p\n",This,ec,ppEnd);
@@ -407,10 +402,9 @@ static HRESULT WINAPI Context_GetEnd (ITfContext *iface, return E_NOTIMPL; }
- cookie = get_Cookie_data(ec); ITextStoreACP_GetEndACP(This->pITextStoreACP,&end);
- return Range_Constructor(iface, This->pITextStoreACP, cookie->lockType, end, end, ppEnd); + return Range_Constructor(iface, end, end, ppEnd); }
static HRESULT WINAPI Context_GetActiveView (ITfContext *iface, @@ -720,7 +714,7 @@ static HRESULT WINAPI InsertAtSelection_InsertTextAtSelection(
hr = ITextStoreACP_InsertTextAtSelection(This->pITextStoreACP, dwFlags, pchText, cch, &acpStart, &acpEnd, &change); if (SUCCEEDED(hr)) - Range_Constructor(&This->ITfContext_iface, This->pITextStoreACP, cookie->lockType, change.acpStart, change.acpNewEnd, ppRange); + Range_Constructor(&This->ITfContext_iface, change.acpStart, change.acpNewEnd, ppRange);
return hr; } diff --git a/dlls/msctf/msctf_internal.h b/dlls/msctf/msctf_internal.h index 9d60e18e6f3..45a39806c22 100644 --- a/dlls/msctf/msctf_internal.h +++ b/dlls/msctf/msctf_internal.h @@ -45,7 +45,7 @@ extern HRESULT DocumentMgr_Constructor(ITfThreadMgrEventSink*, ITfDocumentMgr ** extern HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfDocumentMgr *mgr, ITfContext **ppOut, TfEditCookie *pecTextStore) DECLSPEC_HIDDEN; extern HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) DECLSPEC_HIDDEN; extern HRESULT CategoryMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) DECLSPEC_HIDDEN; -extern HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD lockType, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut) DECLSPEC_HIDDEN; +extern HRESULT Range_Constructor(ITfContext *context, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut) DECLSPEC_HIDDEN; extern HRESULT CompartmentMgr_Constructor(IUnknown *pUnkOuter, REFIID riid, IUnknown **ppOut) DECLSPEC_HIDDEN; extern HRESULT CompartmentMgr_Destructor(ITfCompartmentMgr *This) DECLSPEC_HIDDEN; extern HRESULT LangBarMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) DECLSPEC_HIDDEN; diff --git a/dlls/msctf/range.c b/dlls/msctf/range.c index 85922791bad..ac2540b2b11 100644 --- a/dlls/msctf/range.c +++ b/dlls/msctf/range.c @@ -41,10 +41,8 @@ typedef struct tagRange { /* const ITfRangeACPVtb *RangeACPVtbl; */ LONG refCount;
- ITextStoreACP *pITextStoreACP; ITfContext *context;
- DWORD lockType; TfGravity gravityStart, gravityEnd; DWORD anchorStart, anchorEnd;
@@ -328,7 +326,7 @@ static const ITfRangeVtbl Range_RangeVtbl = Range_GetContext };
-HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD lockType, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut) +HRESULT Range_Constructor(ITfContext *context, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut) { Range *This;
@@ -336,14 +334,12 @@ HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD l if (This == NULL) return E_OUTOFMEMORY;
- TRACE("(%p) %p %p\n",This, context, textstore); + TRACE("(%p) %p\n", This, context);
This->ITfRange_iface.lpVtbl = &Range_RangeVtbl; This->refCount = 1; This->context = context; ITfContext_AddRef(This->context); - This->pITextStoreACP = textstore; - This->lockType = lockType; This->anchorStart = anchorStart; This->anchorEnd = anchorEnd;
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/msctf/range.c | 190 +++++++++++++++--------------- dlls/msctf/tests/inputprocessor.c | 2 +- 2 files changed, 96 insertions(+), 96 deletions(-)
diff --git a/dlls/msctf/range.c b/dlls/msctf/range.c index ac2540b2b11..9690a0a15c4 100644 --- a/dlls/msctf/range.c +++ b/dlls/msctf/range.c @@ -37,8 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msctf);
typedef struct tagRange { - ITfRange ITfRange_iface; - /* const ITfRangeACPVtb *RangeACPVtbl; */ + ITfRangeACP ITfRangeACP_iface; LONG refCount;
ITfContext *context; @@ -48,9 +47,14 @@ typedef struct tagRange {
} Range;
-static inline Range *impl_from_ITfRange(ITfRange *iface) +static inline Range *impl_from_ITfRangeACP(ITfRangeACP *iface) { - return CONTAINING_RECORD(iface, Range, ITfRange_iface); + return CONTAINING_RECORD(iface, Range, ITfRangeACP_iface); +} + +static Range *unsafe_impl_from_ITfRange(ITfRange *iface) +{ + return CONTAINING_RECORD(iface, Range, ITfRangeACP_iface); }
static void Range_Destructor(Range *This) @@ -60,19 +64,22 @@ static void Range_Destructor(Range *This) HeapFree(GetProcessHeap(),0,This); }
-static HRESULT WINAPI Range_QueryInterface(ITfRange *iface, REFIID iid, LPVOID *ppvOut) +static HRESULT WINAPI Range_QueryInterface(ITfRangeACP *iface, REFIID iid, LPVOID *ppvOut) { - Range *This = impl_from_ITfRange(iface); + Range *range = impl_from_ITfRangeACP(iface); + *ppvOut = NULL;
- if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfRange)) + if (IsEqualIID(iid, &IID_IUnknown) || + IsEqualIID(iid, &IID_ITfRange) || + IsEqualIID(iid, &IID_ITfRangeACP)) { - *ppvOut = &This->ITfRange_iface; + *ppvOut = &range->ITfRangeACP_iface; }
if (*ppvOut) { - ITfRange_AddRef(iface); + ITfRangeACP_AddRef(iface); return S_OK; }
@@ -80,136 +87,121 @@ static HRESULT WINAPI Range_QueryInterface(ITfRange *iface, REFIID iid, LPVOID * return E_NOINTERFACE; }
-static ULONG WINAPI Range_AddRef(ITfRange *iface) +static ULONG WINAPI Range_AddRef(ITfRangeACP *iface) { - Range *This = impl_from_ITfRange(iface); - return InterlockedIncrement(&This->refCount); + Range *range = impl_from_ITfRangeACP(iface); + return InterlockedIncrement(&range->refCount); }
-static ULONG WINAPI Range_Release(ITfRange *iface) +static ULONG WINAPI Range_Release(ITfRangeACP *iface) { - Range *This = impl_from_ITfRange(iface); + Range *range = impl_from_ITfRangeACP(iface); ULONG ret;
- ret = InterlockedDecrement(&This->refCount); + ret = InterlockedDecrement(&range->refCount); if (ret == 0) - Range_Destructor(This); + Range_Destructor(range); return ret; }
-/***************************************************** - * ITfRange functions - *****************************************************/ - -static HRESULT WINAPI Range_GetText(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_GetText(ITfRangeACP *iface, TfEditCookie ec, DWORD dwFlags, WCHAR *pchText, ULONG cchMax, ULONG *pcch) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_SetText(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_SetText(ITfRangeACP *iface, TfEditCookie ec, DWORD dwFlags, const WCHAR *pchText, LONG cch) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_GetFormattedText(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_GetFormattedText(ITfRangeACP *iface, TfEditCookie ec, IDataObject **ppDataObject) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_GetEmbedded(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_GetEmbedded(ITfRangeACP *iface, TfEditCookie ec, REFGUID rguidService, REFIID riid, IUnknown **ppunk) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_InsertEmbedded(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_InsertEmbedded(ITfRangeACP *iface, TfEditCookie ec, DWORD dwFlags, IDataObject *pDataObject) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_ShiftStart(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_ShiftStart(ITfRangeACP *iface, TfEditCookie ec, LONG cchReq, LONG *pcch, const TF_HALTCOND *pHalt) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_ShiftEnd(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_ShiftEnd(ITfRangeACP *iface, TfEditCookie ec, LONG cchReq, LONG *pcch, const TF_HALTCOND *pHalt) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_ShiftStartToRange(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_ShiftStartToRange(ITfRangeACP *iface, TfEditCookie ec, ITfRange *pRange, TfAnchor aPos) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_ShiftEndToRange(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_ShiftEndToRange(ITfRangeACP *iface, TfEditCookie ec, ITfRange *pRange, TfAnchor aPos) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_ShiftStartRegion(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_ShiftStartRegion(ITfRangeACP *iface, TfEditCookie ec, TfShiftDir dir, BOOL *pfNoRegion) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_ShiftEndRegion(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_ShiftEndRegion(ITfRangeACP *iface, TfEditCookie ec, TfShiftDir dir, BOOL *pfNoRegion) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_IsEmpty(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_IsEmpty(ITfRangeACP *iface, TfEditCookie ec, BOOL *pfEmpty) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_Collapse(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_Collapse(ITfRangeACP *iface, TfEditCookie ec, TfAnchor aPos) { - Range *This = impl_from_ITfRange(iface); - TRACE("(%p) %i %i\n",This,ec,aPos); + Range *range = impl_from_ITfRangeACP(iface); + + TRACE("%p, %i, %i.\n", iface, ec, aPos);
switch (aPos) { case TF_ANCHOR_START: - This->anchorEnd = This->anchorStart; + range->anchorEnd = range->anchorStart; break; case TF_ANCHOR_END: - This->anchorStart = This->anchorEnd; + range->anchorStart = range->anchorEnd; break; default: return E_INVALIDARG; @@ -218,90 +210,95 @@ static HRESULT WINAPI Range_Collapse(ITfRange *iface, TfEditCookie ec, return S_OK; }
-static HRESULT WINAPI Range_IsEqualStart(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_IsEqualStart(ITfRangeACP *iface, TfEditCookie ec, ITfRange *pWith, TfAnchor aPos, BOOL *pfEqual) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_IsEqualEnd(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_IsEqualEnd(ITfRangeACP *iface, TfEditCookie ec, ITfRange *pWith, TfAnchor aPos, BOOL *pfEqual) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_CompareStart(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_CompareStart(ITfRangeACP *iface, TfEditCookie ec, ITfRange *pWith, TfAnchor aPos, LONG *plResult) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_CompareEnd(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_CompareEnd(ITfRangeACP *iface, TfEditCookie ec, ITfRange *pWith, TfAnchor aPos, LONG *plResult) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_AdjustForInsert(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_AdjustForInsert(ITfRangeACP *iface, TfEditCookie ec, ULONG cchInsert, BOOL *pfInsertOk) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_GetGravity(ITfRange *iface, +static HRESULT WINAPI Range_GetGravity(ITfRangeACP *iface, TfGravity *pgStart, TfGravity *pgEnd) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_SetGravity(ITfRange *iface, TfEditCookie ec, +static HRESULT WINAPI Range_SetGravity(ITfRangeACP *iface, TfEditCookie ec, TfGravity gStart, TfGravity gEnd) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_Clone(ITfRange *iface, ITfRange **ppClone) +static HRESULT WINAPI Range_Clone(ITfRangeACP *iface, ITfRange **ppClone) { - Range *This = impl_from_ITfRange(iface); - FIXME("STUB:(%p)\n",This); + FIXME("STUB:(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI Range_GetContext(ITfRange *iface, ITfContext **context) +static HRESULT WINAPI Range_GetContext(ITfRangeACP *iface, ITfContext **context) { - Range *This = impl_from_ITfRange(iface); + Range *range = impl_from_ITfRangeACP(iface);
- TRACE("(%p, %p)\n", This, context); + TRACE("%p, %p.\n", iface, context);
if (!context) return E_INVALIDARG;
- *context = This->context; + *context = range->context; ITfContext_AddRef(*context);
return S_OK; }
-static const ITfRangeVtbl Range_RangeVtbl = +static HRESULT WINAPI Range_GetExtent(ITfRangeACP *iface, LONG *anchor, LONG *count) +{ + FIXME("%p, %p, %p.\n", iface, anchor, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI Range_SetExtent(ITfRangeACP *iface, LONG anchor, LONG count) +{ + FIXME("%p, %d, %d.\n", iface, anchor, count); + + return E_NOTIMPL; +} + +static const ITfRangeACPVtbl rangevtbl = { Range_QueryInterface, Range_AddRef, Range_Release, - Range_GetText, Range_SetText, Range_GetFormattedText, @@ -323,7 +320,9 @@ static const ITfRangeVtbl Range_RangeVtbl = Range_GetGravity, Range_SetGravity, Range_Clone, - Range_GetContext + Range_GetContext, + Range_GetExtent, + Range_SetExtent, };
HRESULT Range_Constructor(ITfContext *context, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut) @@ -336,14 +335,15 @@ HRESULT Range_Constructor(ITfContext *context, DWORD anchorStart, DWORD anchorEn
TRACE("(%p) %p\n", This, context);
- This->ITfRange_iface.lpVtbl = &Range_RangeVtbl; + This->ITfRangeACP_iface.lpVtbl = &rangevtbl; This->refCount = 1; This->context = context; ITfContext_AddRef(This->context); This->anchorStart = anchorStart; This->anchorEnd = anchorEnd;
- *ppOut = &This->ITfRange_iface; + *ppOut = (ITfRange *)&This->ITfRangeACP_iface; + TRACE("returning %p\n", *ppOut);
return S_OK; @@ -358,7 +358,7 @@ HRESULT TF_SELECTION_to_TS_SELECTION_ACP(const TF_SELECTION *tf, TS_SELECTION_AC if (!tf || !tsAcp || !tf->range) return E_INVALIDARG;
- This = impl_from_ITfRange(tf->range); + This = unsafe_impl_from_ITfRange(tf->range);
tsAcp->acpStart = This->anchorStart; tsAcp->acpEnd = This->anchorEnd; diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c index fd03059e545..24362e9ef0a 100644 --- a/dlls/msctf/tests/inputprocessor.c +++ b/dlls/msctf/tests/inputprocessor.c @@ -2130,8 +2130,8 @@ TfEditCookie ec) ITfContext_Release(context2);
hr = ITfRange_QueryInterface(range, &IID_ITfRangeACP, (void **)&unk); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IUnknown_Release(unk);
ITfRange_Release(range);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/msctf/context.c | 4 ++-- dlls/msctf/tests/inputprocessor.c | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c index 9eb61efa411..e901cbcbee4 100644 --- a/dlls/msctf/context.c +++ b/dlls/msctf/context.c @@ -1022,9 +1022,9 @@ static HRESULT WINAPI TextStoreACPServices_CreateRange(ITextStoreACPServices *if { Context *This = impl_from_ITextStoreACPServices(iface);
- FIXME("stub: %p %d %d %p\n", This, start, end, range); + TRACE("%p, %d, %d, %p.\n", This, start, end, range);
- return S_OK; + return Range_Constructor(&This->ITfContext_iface, start, end, (ITfRange **)range); }
static const ITextStoreACPServicesVtbl TextStoreACPServicesVtbl = diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c index 24362e9ef0a..67d1db1dbfb 100644 --- a/dlls/msctf/tests/inputprocessor.c +++ b/dlls/msctf/tests/inputprocessor.c @@ -249,13 +249,11 @@ static HRESULT WINAPI TextStoreACP_AdviseSink(ITextStoreACP *iface, range = NULL; hr = ITextStoreACPServices_CreateRange(services, 0, 1, &range); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - if (range) - { - hr = ITfRangeACP_GetContext(range, &context); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - ITfContext_Release(context); - ITfRangeACP_Release(range); - } + + hr = ITfRangeACP_GetContext(range, &context); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ITfContext_Release(context); + ITfRangeACP_Release(range);
ITextStoreACPServices_Release(services);