Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56781 Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
From: Nikolay Sivov nsivov@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56781 Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/scrrun/dictionary.c | 14 ++++++++---- dlls/scrrun/tests/dictionary.c | 41 +++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 5 deletions(-)
diff --git a/dlls/scrrun/dictionary.c b/dlls/scrrun/dictionary.c index f2f39c82f6f..af771c9245a 100644 --- a/dlls/scrrun/dictionary.c +++ b/dlls/scrrun/dictionary.c @@ -559,11 +559,17 @@ static HRESULT WINAPI dictionary_Invoke(IDictionary *iface, DISPID dispIdMember, return hr; }
-static HRESULT WINAPI dictionary_putref_Item(IDictionary *iface, VARIANT *Key, VARIANT *pRetItem) +static HRESULT WINAPI dictionary_putref_Item(IDictionary *iface, VARIANT *key, VARIANT *item) { - FIXME("%p, %p, %p stub\n", iface, Key, pRetItem); + struct dictionary *dictionary = impl_from_IDictionary(iface); + struct keyitem_pair *pair;
- return E_NOTIMPL; + TRACE("%p, %s, %s.\n", iface, debugstr_variant(key), debugstr_variant(item)); + + if ((pair = get_keyitem_pair(dictionary, key))) + return VariantCopyInd(&pair->item, item); + + return add_keyitem_pair(dictionary, key, item); }
static HRESULT WINAPI dictionary_put_Item(IDictionary *iface, VARIANT *key, VARIANT *item) @@ -576,7 +582,7 @@ static HRESULT WINAPI dictionary_put_Item(IDictionary *iface, VARIANT *key, VARI if ((pair = get_keyitem_pair(dictionary, key))) return VariantCopyInd(&pair->item, item);
- return IDictionary_Add(iface, key, item); + return add_keyitem_pair(dictionary, key, item); }
static HRESULT WINAPI dictionary_get_Item(IDictionary *iface, VARIANT *key, VARIANT *item) diff --git a/dlls/scrrun/tests/dictionary.c b/dlls/scrrun/tests/dictionary.c index ccc4d181793..e1cb33c45a7 100644 --- a/dlls/scrrun/tests/dictionary.c +++ b/dlls/scrrun/tests/dictionary.c @@ -243,7 +243,6 @@ static HRESULT WINAPI test_unk_no_QI(IUnknown *iface, REFIID riid, void **obj)
static ULONG WINAPI test_unk_AddRef(IUnknown *iface) { - ok(0, "unexpected\n"); return 2; }
@@ -1168,6 +1167,45 @@ static void test_IEnumVARIANT(void) IDictionary_Release(dict); }
+static void test_putref_Item(void) +{ + IUnknown *obj = &test_unk; + VARIANT key, item, item2; + IDictionary *dict; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_Dictionary, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, + &IID_IDictionary, (void **)&dict); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + V_VT(&key) = VT_I2; + V_I2(&key) = 10; + V_VT(&item) = VT_UNKNOWN; + V_UNKNOWN(&item) = obj; + hr = IDictionary_putref_Item(dict, &key, &item); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + VariantInit(&item2); + hr = IDictionary_get_Item(dict, &key, &item2); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(V_VT(&item2) == VT_UNKNOWN, "Unexpected type.\n"); + ok(V_UNKNOWN(&item2) == obj, "Unexpected value.\n"); + VariantClear(&item2); + + V_VT(&key) = VT_I2; + V_I2(&key) = 11; + V_VT(&item) = VT_UNKNOWN|VT_BYREF; + V_UNKNOWNREF(&item) = &obj; + hr = IDictionary_putref_Item(dict, &key, &item); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IDictionary_get_Item(dict, &key, &item2); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(V_VT(&item2) == VT_UNKNOWN, "Unexpected type.\n"); + ok(V_UNKNOWN(&item2) == obj, "Unexpected value.\n"); + + IDictionary_Release(dict); +} + START_TEST(dictionary) { IDispatch *disp; @@ -1193,6 +1231,7 @@ START_TEST(dictionary) test_Item(); test_Add(); test_IEnumVARIANT(); + test_putref_Item();
CoUninitialize(); }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=146083
Your paranoid android.
=== debian11b (64 bit WoW report) ===
Report validation errors: shell32:shelllink crashed (c0000005)