Nikolay Sivov : ole32: Fix IsEqual() for antimoniker.
Alexandre Julliard
julliard at winehq.org
Fri Jan 24 16:14:10 CST 2020
Module: wine
Branch: master
Commit: 9a4959de4a4aeeacdd886a222b7f2db60b25f045
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9a4959de4a4aeeacdd886a222b7f2db60b25f045
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Jan 24 12:21:29 2020 +0300
ole32: Fix IsEqual() for antimoniker.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ole32/antimoniker.c | 28 +++++++++++++++++-----------
dlls/ole32/tests/moniker.c | 5 -----
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/dlls/ole32/antimoniker.c b/dlls/ole32/antimoniker.c
index bff6500fa5..9b02129021 100644
--- a/dlls/ole32/antimoniker.c
+++ b/dlls/ole32/antimoniker.c
@@ -53,6 +53,7 @@ static inline AntiMonikerImpl *impl_from_IROTData(IROTData *iface)
return CONTAINING_RECORD(iface, AntiMonikerImpl, IROTData_iface);
}
+static AntiMonikerImpl *unsafe_impl_from_IMoniker(IMoniker *iface);
/*******************************************************************************
* AntiMoniker_QueryInterface
@@ -308,22 +309,20 @@ AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker
/******************************************************************************
* AntiMoniker_IsEqual
******************************************************************************/
-static HRESULT WINAPI
-AntiMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
+static HRESULT WINAPI AntiMonikerImpl_IsEqual(IMoniker *iface, IMoniker *other)
{
- DWORD mkSys;
-
- TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
+ AntiMonikerImpl *moniker = impl_from_IMoniker(iface), *other_moniker;
- if (pmkOtherMoniker==NULL)
- return S_FALSE;
+ TRACE("%p, %p.\n", iface, other);
- IMoniker_IsSystemMoniker(pmkOtherMoniker,&mkSys);
+ if (!other)
+ return E_INVALIDARG;
- if (mkSys==MKSYS_ANTIMONIKER)
- return S_OK;
- else
+ other_moniker = unsafe_impl_from_IMoniker(other);
+ if (!other_moniker)
return S_FALSE;
+
+ return moniker->count == other_moniker->count ? S_OK : S_FALSE;
}
/******************************************************************************
@@ -588,6 +587,13 @@ static const IMonikerVtbl VT_AntiMonikerImpl =
AntiMonikerImpl_IsSystemMoniker
};
+static AntiMonikerImpl *unsafe_impl_from_IMoniker(IMoniker *iface)
+{
+ if (iface->lpVtbl != &VT_AntiMonikerImpl)
+ return NULL;
+ return CONTAINING_RECORD(iface, AntiMonikerImpl, IMoniker_iface);
+}
+
/********************************************************************************/
/* Virtual function table for the IROTData class. */
static const IROTDataVtbl VT_ROTDataImpl =
diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c
index dff6cbbe57..65cd279b1a 100644
--- a/dlls/ole32/tests/moniker.c
+++ b/dlls/ole32/tests/moniker.c
@@ -2331,11 +2331,9 @@ todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMoniker_IsEqual(moniker, moniker2);
-todo_wine
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
hr = IMoniker_IsEqual(moniker2, moniker);
-todo_wine
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
hr = IMoniker_Hash(moniker, &hash);
@@ -2374,11 +2372,9 @@ todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMoniker_IsEqual(moniker, moniker2);
-todo_wine
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
hr = IMoniker_IsEqual(moniker2, moniker);
-todo_wine
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
hr = IMoniker_Hash(moniker, &hash);
@@ -2403,7 +2399,6 @@ todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMoniker_IsEqual(moniker, NULL);
-todo_wine
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
IStream_Release(stream);
More information about the wine-cvs
mailing list