Added patch for IRichEditOle and ITextDocument support for ITextServices.

This commit is contained in:
Sebastian Lackner 2014-09-29 04:49:46 +02:00
parent acacbd588d
commit e9da761795
16 changed files with 406 additions and 22 deletions

View File

@ -35,7 +35,7 @@ Wine. All those differences are also documented on the
Included bugfixes and improvements
==================================
**Bugfixes and features included in the next upcoming release [9]:**
**Bugfixes and features included in the next upcoming release [10]:**
* Correctly treat '.' when checking for empty directories ([Wine Bug #26272](http://bugs.winehq.org/show_bug.cgi?id=26272))
* Do not fail when a used context is passed to wglShareLists ([Wine Bug #11436](http://bugs.winehq.org/show_bug.cgi?id=11436))
@ -44,6 +44,7 @@ Included bugfixes and improvements
* Limit cross thread access to ImmSet* functions ([Wine Bug #35361](http://bugs.winehq.org/show_bug.cgi?id=35361))
* Send WM_PAINT event during dialog creation ([Wine Bug #35652](http://bugs.winehq.org/show_bug.cgi?id=35652))
* Support for FIND_FIRST_EX_CASE_SENSITIVE flag in FindFirstFileExW
* Support for IRichEditOle and ITextDocument support for ITextServices. ([Wine Bug #17042](http://bugs.winehq.org/show_bug.cgi?id=17042))
* Unity3D Editor requires ProductId registry value ([Wine Bug #36964](http://bugs.winehq.org/show_bug.cgi?id=36964))
* Update a XIM candidate position when cursor location changes ([Wine Bug #30938](http://bugs.winehq.org/show_bug.cgi?id=30938))

1
debian/changelog vendored
View File

@ -9,6 +9,7 @@ wine-compholio (1.7.28) UNRELEASED; urgency=low
* Added patch to fix differences between exception handling behaviour in Wine and Windows.
* Added patch to export ?_BADOFF@std@@3_JB on both i386 and win64.
* Added patch to limit cross thread access to ImmSet* functions.
* Added patch for IRichEditOle and ITextDocument support for ITextServices.
-- Sebastian Lackner <sebastian@fds-team.de> Sun, 21 Sep 2014 01:44:14 +0200
wine-compholio (1.7.27) unstable; urgency=low

View File

@ -809,13 +809,17 @@ quartz-MediaSeeking_Positions.ok:
# | * Implement Stubs for ITextPara interface. [rev 2, by Jactry Zeng]
# | * Implement ITextRange/Selection::{GetChar,GetStart,GetEnd,GetDuplicate,Collapse,SetStart,SetEnd}. [by Jactry Zeng]
# | * Implement ITextRange/Selection::{GetText,SetRange,IsEqual,GetStoryLength}. [by Jactry Zeng]
# | * Add COM aggregation support for IRichEditOle. [by Jactry Zeng]
# | * Implement IRichEditOle and ITextDocument support for ITextServices. [by Jactry Zeng]
# |
# | This patchset fixes the following Wine bugs:
# | * [#12458] Support for ITextDocument_fnRange function
# | * [#18303] Support for ITextRange, ITextFont and ITextPara
# | * [#17042] Support for IRichEditOle and ITextDocument support for ITextServices.
# |
# | Modified files:
# | * dlls/riched20/richole.c, dlls/riched20/run.c, dlls/riched20/tests/richole.c
# | * dlls/riched20/editor.c, dlls/riched20/editor.h, dlls/riched20/richole.c, dlls/riched20/run.c,
# | dlls/riched20/tests/richole.c, dlls/riched20/tests/txtsrv.c, dlls/riched20/txtsrv.c
# |
.INTERMEDIATE: riched20-IText_Interface.ok
riched20-IText_Interface.ok:
@ -829,12 +833,16 @@ riched20-IText_Interface.ok:
$(call APPLY_FILE,riched20-IText_Interface/0008-riched20-Implement-ITextRange-GetStoryLength.patch)
$(call APPLY_FILE,riched20-IText_Interface/0009-riched20-Implement-ITextSelection-GetStoryLength.patch)
$(call APPLY_FILE,riched20-IText_Interface/0010-riched20-Fix-invalid-memory-access-when-parent-objec.patch)
$(call APPLY_FILE,riched20-IText_Interface/0011-riched20-Add-COM-aggregation-support-for-IRichEditOl.patch)
$(call APPLY_FILE,riched20-IText_Interface/0012-riched20-Add-IID_IRichEditOle-and-IID_ITextDocument-.patch)
@( \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement Stubs for ITextRange interface. [rev 3]" },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement Stubs for ITextFont interface. [rev 2]" },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement Stubs for ITextPara interface. [rev 2]" },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement ITextRange/Selection::{GetChar,GetStart,GetEnd,GetDuplicate,Collapse,SetStart,SetEnd}." },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement ITextRange/Selection::{GetText,SetRange,IsEqual,GetStoryLength}." },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Add COM aggregation support for IRichEditOle." },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement IRichEditOle and ITextDocument support for ITextServices." },'; \
) > riched20-IText_Interface.ok
# Patchset server-ACL_Compat

View File

@ -1,4 +1,4 @@
From bca17fd4f0c51b2c803a824018f4242dcdc174b0 Mon Sep 17 00:00:00 2001
From ead5fc245c8b1e731066056d8e758e4d7e476e5a Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Fri, 8 Aug 2014 21:32:57 +0800
Subject: riched20: Implement IText{Selection, Range}::Set{Start, End}.
@ -268,5 +268,5 @@ index eed335c..2268211 100644
+ test_ITextRange_SetEnd();
}
--
2.1.0
2.1.1

View File

@ -1,4 +1,4 @@
From 01ab296e4cdbe2ac1ee7123b5593b5b0806360ae Mon Sep 17 00:00:00 2001
From 348a74688b600ebdae6dd87ad68d34540b0aab31 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Mon, 11 Aug 2014 13:51:55 +0800
Subject: riched20: Stub for ITextFont interface and implement
@ -1004,5 +1004,5 @@ index 2268211..e9618d8 100644
+ test_ITextRange_GetFont();
}
--
2.1.0
2.1.1

View File

@ -1,4 +1,4 @@
From 86972b35873c1a1b66178d19faaed03583f3004c Mon Sep 17 00:00:00 2001
From fa8d998f8e114603e86f9be0eb9ff10e966a8a22 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Sun, 10 Aug 2014 22:17:57 +0800
Subject: riched20: Stub for ITextPara interface and implement
@ -823,5 +823,5 @@ index e9618d8..909d27e 100644
+ test_ITextRange_GetPara();
}
--
2.1.0
2.1.1

View File

@ -1,4 +1,4 @@
From 6e017cb053086f1e59e162459d8c1039aaf406ba Mon Sep 17 00:00:00 2001
From a940996f866525406a88de4c9bdc29dd8975b44f Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Wed, 13 Aug 2014 14:57:52 +0800
Subject: riched20: Fix ME_RunOfsFromCharOfs() when nCharOfs > strlen().
@ -37,5 +37,5 @@ index 38d0270..ad08b82 100644
/******************************************************************************
--
2.1.0
2.1.1

View File

@ -1,4 +1,4 @@
From 0ffb5cd3d2dab750400bb3cb3720988f44d89015 Mon Sep 17 00:00:00 2001
From 833c6b92679458852109cf79b5c2ef78690a9dfe Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Wed, 13 Aug 2014 15:40:11 +0800
Subject: riched20: Implement ITextRange::GetText.
@ -144,5 +144,5 @@ index 909d27e..0079b39 100644
+ test_ITextRange_GetText();
}
--
2.1.0
2.1.1

View File

@ -1,4 +1,4 @@
From 22dd892538a54977796a10a7636e3ce3bd0d5b2c Mon Sep 17 00:00:00 2001
From ec444cc051ee078b44b33969ba5f87c166564a44 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Wed, 13 Aug 2014 17:17:14 +0800
Subject: riched20: Implement ITextRange::SetRange.
@ -131,5 +131,5 @@ index 0079b39..e7618f9 100644
+ test_ITextRange_SetRange();
}
--
2.1.0
2.1.1

View File

@ -1,4 +1,4 @@
From 1f28067484ebf7e6f2cce716dccf5f91e3a99775 Mon Sep 17 00:00:00 2001
From bb119bc50abcfb5e5fe2ee3281e37633b1cfd30f Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Fri, 15 Aug 2014 14:27:21 +0800
Subject: riched20: Implement ITextRange::IsEqual.
@ -108,5 +108,5 @@ index e7618f9..7a4c8b5 100644
+ test_ITextRange_IsEqual();
}
--
2.1.0
2.1.1

View File

@ -1,4 +1,4 @@
From ddc9f89d9bd685787ee9eb153d5c54c07edeea4d Mon Sep 17 00:00:00 2001
From 683cdc6fcf55fd27b1245ebc9d74f3dd7e3cfdb1 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Mon, 18 Aug 2014 14:38:50 +0800
Subject: riched20: Implement ITextRange::GetStoryLength.
@ -74,5 +74,5 @@ index 7a4c8b5..543f3ec 100644
+ test_ITextRange_GetStoryLength();
}
--
2.1.0
2.1.1

View File

@ -1,4 +1,4 @@
From 857fe4e24351a2487dde9de829e00f56850bfe85 Mon Sep 17 00:00:00 2001
From 904c284e5d9914c798fdc891b391b225d7fdacda Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Mon, 18 Aug 2014 14:47:14 +0800
Subject: riched20: Implement ITextSelection::GetStoryLength.
@ -74,5 +74,5 @@ index 543f3ec..baed1f7 100644
test_ITextRange_GetChar();
test_ITextRange_GetStart_GetEnd();
--
2.1.0
2.1.1

View File

@ -1,4 +1,4 @@
From 4e012209e8fb3780e4b0c18657a35cb2e3f835dc Mon Sep 17 00:00:00 2001
From 64a00c5a487e9366c4bfdbd5273bd10ec2a1bdcd Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 13 Sep 2014 17:21:31 +0200
Subject: riched20: Fix invalid memory access when parent object was destroyed
@ -45,5 +45,5 @@ index f2b4348..449b012 100644
}
return ref;
--
2.1.0
2.1.1

View File

@ -0,0 +1,227 @@
From a91a7228c9547ea780b63576b021fca65af418d4 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <jzeng@codeweavers.com>
Date: Sun, 28 Sep 2014 13:17:49 +0800
Subject: riched20: Add COM aggregation support for IRichEditOle.
---
dlls/riched20/editor.c | 4 +-
dlls/riched20/editor.h | 2 +-
dlls/riched20/richole.c | 99 ++++++++++++++++++++++++++++++++++---------------
3 files changed, 72 insertions(+), 33 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 3c0d970..a331001 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1194,7 +1194,7 @@ static BOOL ME_RTFInsertOleObject(RTF_Info *info, HENHMETAFILE hemf, HBITMAP hbm
if (!info->lpRichEditOle)
{
- CreateIRichEditOle(info->editor, (VOID**)&info->lpRichEditOle);
+ CreateIRichEditOle(NULL, info->editor, (VOID**)&info->lpRichEditOle);
}
if (OleCreateDefaultHandler(&CLSID_NULL, NULL, &IID_IOleObject, (void**)&lpObject) == S_OK &&
@@ -4474,7 +4474,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
case EM_GETOLEINTERFACE:
{
if (!editor->reOle)
- if (!CreateIRichEditOle(editor, (LPVOID *)&editor->reOle))
+ if (!CreateIRichEditOle(NULL, editor, (LPVOID *)&editor->reOle))
return 0;
*(LPVOID *)lParam = editor->reOle;
IRichEditOle_AddRef(editor->reOle);
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index edbac8e..75a3894 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -240,7 +240,7 @@ void ME_UpdateScrollBar(ME_TextEditor *editor) DECLSPEC_HIDDEN;
int ME_GetParaBorderWidth(const ME_Context *c, int flags) DECLSPEC_HIDDEN;
/* richole.c */
-LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *) DECLSPEC_HIDDEN;
+LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *ppvObj) DECLSPEC_HIDDEN;
void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run* run, ME_Paragraph *para, BOOL selected) DECLSPEC_HIDDEN;
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN;
void ME_CopyReObject(REOBJECT* dst, const REOBJECT* src) DECLSPEC_HIDDEN;
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 449b012..7e620ef 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -56,8 +56,10 @@ typedef struct ITextFontImpl ITextFontImpl;
typedef struct ITextParaImpl ITextParaImpl;
typedef struct IRichEditOleImpl {
+ IUnknown IUnknown_inner;
IRichEditOle IRichEditOle_iface;
ITextDocument ITextDocument_iface;
+ IUnknown *outer_unk;
LONG ref;
ME_TextEditor *editor;
@@ -111,54 +113,45 @@ struct IOleClientSiteImpl {
IRichEditOleImpl *reOle;
};
-static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface)
+static inline IRichEditOleImpl *impl_from_IUnknown(IUnknown *iface)
{
- return CONTAINING_RECORD(iface, IRichEditOleImpl, IRichEditOle_iface);
+ return CONTAINING_RECORD(iface, IRichEditOleImpl, IUnknown_inner);
}
-static inline IRichEditOleImpl *impl_from_ITextDocument(ITextDocument *iface)
+static HRESULT WINAPI IRichEditOleImpl_fnQueryInterface(IUnknown *iface, REFIID riid, LPVOID* ppvObj)
{
- return CONTAINING_RECORD(iface, IRichEditOleImpl, ITextDocument_iface);
-}
+ IRichEditOleImpl *This = impl_from_IUnknown(iface);
-static HRESULT WINAPI
-IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
-{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
-
- TRACE("%p %s\n", This, debugstr_guid(riid) );
+ TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObj);
- *ppvObj = NULL;
- if (IsEqualGUID(riid, &IID_IUnknown) ||
- IsEqualGUID(riid, &IID_IRichEditOle))
+ if (IsEqualGUID(riid, &IID_IUnknown))
+ *ppvObj = &This->IUnknown_inner;
+ else if (IsEqualGUID(riid, &IID_IRichEditOle))
*ppvObj = &This->IRichEditOle_iface;
else if (IsEqualGUID(riid, &IID_ITextDocument))
*ppvObj = &This->ITextDocument_iface;
- if (*ppvObj)
- {
- IRichEditOle_AddRef(me);
- return S_OK;
+ else {
+ FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid));
+ return E_NOINTERFACE;
}
- FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid) );
-
- return E_NOINTERFACE;
+
+ IUnknown_AddRef((IUnknown *)*ppvObj);
+ return S_OK;
}
-static ULONG WINAPI
-IRichEditOle_fnAddRef(IRichEditOle *me)
+static ULONG WINAPI IRichEditOleImpl_fnAddRef(IUnknown *iface)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
- ULONG ref = InterlockedIncrement( &This->ref );
+ IRichEditOleImpl *This = impl_from_IUnknown(iface);
+ ULONG ref = InterlockedIncrement(&This->ref);
TRACE("%p ref = %u\n", This, ref);
return ref;
}
-static ULONG WINAPI
-IRichEditOle_fnRelease(IRichEditOle *me)
+static ULONG WINAPI IRichEditOleImpl_fnRelease(IUnknown *iface)
{
- IRichEditOleImpl *This = impl_from_IRichEditOle(me);
+ IRichEditOleImpl *This = impl_from_IUnknown(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE ("%p ref=%u\n", This, ref);
@@ -170,6 +163,7 @@ IRichEditOle_fnRelease(IRichEditOle *me)
ITextParaImpl *txtPara;
TRACE ("Destroying %p\n", This);
This->txtSel->reOle = NULL;
+ This->editor->reOle = NULL;
ITextSelection_Release(&This->txtSel->ITextSelection_iface);
IOleClientSite_Release(&This->clientSite->IOleClientSite_iface);
LIST_FOR_EACH_ENTRY(txtRge, &This->rangelist, ITextRangeImpl, entry)
@@ -183,6 +177,44 @@ IRichEditOle_fnRelease(IRichEditOle *me)
return ref;
}
+static const IUnknownVtbl reo_unk_vtbl =
+{
+ IRichEditOleImpl_fnQueryInterface,
+ IRichEditOleImpl_fnAddRef,
+ IRichEditOleImpl_fnRelease
+};
+
+static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface)
+{
+ return CONTAINING_RECORD(iface, IRichEditOleImpl, IRichEditOle_iface);
+}
+
+static inline IRichEditOleImpl *impl_from_ITextDocument(ITextDocument *iface)
+{
+ return CONTAINING_RECORD(iface, IRichEditOleImpl, ITextDocument_iface);
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
+{
+ IRichEditOleImpl *This = impl_from_IRichEditOle(me);
+ return IUnknown_QueryInterface(This->outer_unk, riid, ppvObj);
+}
+
+static ULONG WINAPI
+IRichEditOle_fnAddRef(IRichEditOle *me)
+{
+ IRichEditOleImpl *This = impl_from_IRichEditOle(me);
+ return IUnknown_AddRef(This->outer_unk);
+}
+
+static ULONG WINAPI
+IRichEditOle_fnRelease(IRichEditOle *me)
+{
+ IRichEditOleImpl *This = impl_from_IRichEditOle(me);
+ return IUnknown_Release(This->outer_unk);
+}
+
static HRESULT WINAPI
IRichEditOle_fnActivateAs(IRichEditOle *me, REFCLSID rclsid, REFCLSID rclsidAs)
{
@@ -3855,7 +3887,7 @@ CreateTextSelection(IRichEditOleImpl *reOle)
return txtSel;
}
-LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
+LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *ppObj)
{
IRichEditOleImpl *reo;
@@ -3863,6 +3895,7 @@ LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
if (!reo)
return 0;
+ reo->IUnknown_inner.lpVtbl = &reo_unk_vtbl;
reo->IRichEditOle_iface.lpVtbl = &revt;
reo->ITextDocument_iface.lpVtbl = &tdvt;
reo->ref = 1;
@@ -3881,11 +3914,17 @@ LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
return 0;
}
TRACE("Created %p\n",reo);
- *ppObj = reo;
+
list_init(&reo->rangelist);
list_init(&reo->fontlist);
list_init(&reo->paralist);
+ if (outer_unk)
+ reo->outer_unk = outer_unk;
+ else
+ reo->outer_unk = &reo->IUnknown_inner;
+ *ppObj = reo;
+
return 1;
}
--
2.1.1

View File

@ -0,0 +1,138 @@
From 70568da80d69a946df0aaa574d3cf4e9bb416a8d Mon Sep 17 00:00:00 2001
From: Jactry Zeng <jzeng@codeweavers.com>
Date: Sun, 28 Sep 2014 14:03:15 +0800
Subject: riched20: Add IID_IRichEditOle and IID_ITextDocument support for
ITextServices::QueryInterface.
---
dlls/riched20/tests/txtsrv.c | 69 ++++++++++++++++++++++++++++++++++++++++++++
dlls/riched20/txtsrv.c | 12 +++++++-
2 files changed, 80 insertions(+), 1 deletion(-)
diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c
index 3401f8b..c154e2d 100644
--- a/dlls/riched20/tests/txtsrv.c
+++ b/dlls/riched20/tests/txtsrv.c
@@ -29,6 +29,8 @@
#include <winbase.h>
#include <objbase.h>
#include <richedit.h>
+#include <tom.h>
+#include <richole.h>
#include <initguid.h>
#include <imm.h>
#include <textserv.h>
@@ -862,6 +864,72 @@ static void test_COM(void)
IUnknown_Release(unk_obj.inner_unk);
}
+static ULONG get_refcount(IUnknown *iface)
+{
+ IUnknown_AddRef(iface);
+ return IUnknown_Release(iface);
+}
+
+static void test_QueryInterface(void)
+{
+ HRESULT hres;
+ IRichEditOle *reole, *txtsrv_reole;
+ ITextDocument *txtdoc, *txtsrv_txtdoc;
+ ULONG refcount;
+
+ if(!init_texthost())
+ return;
+
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 1, "got wrong ref count: %d\n", refcount);
+
+ /* IID_IRichEditOle */
+ hres = ITextServices_QueryInterface(txtserv, &IID_IRichEditOle, (void **)&txtsrv_reole);
+ ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+ refcount = get_refcount((IUnknown *)txtsrv_reole);
+ ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+
+ hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument, (void **)&txtdoc);
+ ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+ refcount = get_refcount((IUnknown *)txtsrv_reole);
+ ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+
+ ITextDocument_Release(txtdoc);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+ IRichEditOle_Release(txtsrv_reole);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 1, "got wrong ref count: %d\n", refcount);
+
+ /* IID_ITextDocument */
+ hres = ITextServices_QueryInterface(txtserv, &IID_ITextDocument, (void **)&txtsrv_txtdoc);
+ ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+ refcount = get_refcount((IUnknown *)txtsrv_txtdoc);
+ ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+
+ hres = ITextDocument_QueryInterface(txtsrv_txtdoc, &IID_IRichEditOle, (void **)&reole);
+ ok(hres == S_OK, "ITextDocument_QueryInterface: 0x%08x\n", hres);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+ refcount = get_refcount((IUnknown *)txtsrv_txtdoc);
+ ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+
+ IRichEditOle_Release(reole);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+ ITextDocument_Release(txtsrv_txtdoc);
+ refcount = get_refcount((IUnknown *)txtserv);
+ ok(refcount == 1, "got wrong ref count: %d\n", refcount);
+
+ free_texthost();
+}
+
START_TEST( txtsrv )
{
setup_thiscall_wrappers();
@@ -887,6 +955,7 @@ START_TEST( txtsrv )
test_TxSetText();
test_TxGetNaturalSize();
test_TxDraw();
+ test_QueryInterface();
}
if (wrapperCodeMem) VirtualFree(wrapperCodeMem, 0, MEM_RELEASE);
}
diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c
index 636efff..3283534 100644
--- a/dlls/riched20/txtsrv.c
+++ b/dlls/riched20/txtsrv.c
@@ -29,6 +29,7 @@
#include "ole2.h"
#include "oleauto.h"
#include "richole.h"
+#include "tom.h"
#include "imm.h"
#include "textserv.h"
#include "wine/debug.h"
@@ -79,7 +80,16 @@ static HRESULT WINAPI ITextServicesImpl_QueryInterface(IUnknown *iface, REFIID r
*ppv = &This->IUnknown_inner;
else if (IsEqualIID(riid, &IID_ITextServices))
*ppv = &This->ITextServices_iface;
- else {
+ else if (IsEqualIID(riid, &IID_IRichEditOle) || IsEqualIID(riid, &IID_ITextDocument))
+ {
+ if (!This->editor->reOle)
+ if (!CreateIRichEditOle(This->outer_unk, This->editor, (LPVOID *)&(This->editor->reOle)))
+ return E_OUTOFMEMORY;
+ IRichEditOle_QueryInterface(This->editor->reOle, riid, ppv);
+ return S_OK;
+ }
+ else
+ {
*ppv = NULL;
FIXME("Unknown interface: %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
--
2.1.1

View File

@ -18,5 +18,14 @@ Author: Jactry Zeng
Subject: Implement ITextRange/Selection::{GetText,SetRange,IsEqual,GetStoryLength}.
Revision: 1
Author: Jactry Zeng
Subject: Add COM aggregation support for IRichEditOle.
Revision: 1
Author: Jactry Zeng
Subject: Implement IRichEditOle and ITextDocument support for ITextServices.
Revision: 1
Fixes: [12458] Support for ITextDocument_fnRange function
Fixes: [18303] Support for ITextRange, ITextFont and ITextPara
Fixes: [17042] Support for IRichEditOle and ITextDocument support for ITextServices.