Signed-off-by: Jactry Zeng jzeng@codeweavers.com --- dlls/riched20/richole.c | 6 +++++- dlls/riched20/tests/richole.c | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c index dc1a3b8405..93fe203cf2 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -1393,7 +1393,11 @@ IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob, } else { - if (iob > IRichEditOle_GetObjectCount(me)) + int object_count = IRichEditOle_GetObjectCount(me); + + if (iob == -1) + iob = object_count - 1; + if (iob < 0 || iob >= object_count) return E_INVALIDARG; LIST_FOR_EACH_ENTRY(reobj, &This->editor->reobj_list, struct re_object, entry) { diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c index d3ffdce4a7..5b46dafcdc 100644 --- a/dlls/riched20/tests/richole.c +++ b/dlls/riched20/tests/richole.c @@ -3276,9 +3276,18 @@ static void test_InsertObject(void) ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08x\n", hr); CHECK_REOBJECT_STRUCT(received_reo3, NULL, NULL, reo2.polesite, 2);
+ received_reo3.cbStruct = sizeof(received_reo3); + hr = IRichEditOle_GetObject(reole, -1, &received_reo3, REO_GETOBJ_ALL_INTERFACES); + ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08x\n", hr); + CHECK_REOBJECT_STRUCT(received_reo3, NULL, NULL, reo2.polesite, 2); + hr = IRichEditOle_GetObject(reole, 2, NULL, REO_GETOBJ_ALL_INTERFACES); ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
+ received_reo4.cbStruct = sizeof(received_reo4); + hr = IRichEditOle_GetObject(reole, -2, &received_reo4, REO_GETOBJ_ALL_INTERFACES); + ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr); + received_reo4.cbStruct = 0; hr = IRichEditOle_GetObject(reole, 2, &received_reo4, REO_GETOBJ_ALL_INTERFACES); ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=46486
Your paranoid android.
=== wvistau64 (64 bit report) ===
riched20: richole.c:3289: Test failed: IRichEditOle_GetObject should fail: 0x00000000
=== w2008s64 (64 bit report) ===
riched20: richole.c:3289: Test failed: IRichEditOle_GetObject should fail: 0x00000000
=== w7pro64 (64 bit report) ===
riched20: richole.c:3289: Test failed: IRichEditOle_GetObject should fail: 0x00000000
=== w864 (64 bit report) ===
riched20: richole.c:3289: Test failed: IRichEditOle_GetObject should fail: 0x00000000
=== w1064 (64 bit report) ===
riched20: richole.c:3289: Test failed: IRichEditOle_GetObject should fail: 0x00000000
=== debian9 (32 bit report) ===
riched20: richole.c:3289: Test failed: IRichEditOle_GetObject should fail: 0x00000000
=== debian9 (32 bit French report) ===
riched20: richole.c:3289: Test failed: IRichEditOle_GetObject should fail: 0x00000000
=== debian9 (32 bit Japanese:Japan report) ===
riched20: richole.c:3289: Test failed: IRichEditOle_GetObject should fail: 0x00000000
=== debian9 (32 bit Chinese:China report) ===
riched20: richole.c:3289: Test failed: IRichEditOle_GetObject should fail: 0x00000000
=== debian9 (32 bit WoW report) ===
riched20: richole.c:3289: Test failed: IRichEditOle_GetObject should fail: 0x00000000
=== debian9 (64 bit WoW report) ===
riched20: richole.c:3289: Test failed: IRichEditOle_GetObject should fail: 0x00000000
This doesn't look right, if -1 is REO_IOB_SELECTION this should be handled similarly to REO_IOB_USE_CP.