ole32: Fix CommonPrefixWith() for antimoniker, when other is also antimoniker.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
31f5f9da80
commit
cdf51b3922
|
@ -400,25 +400,32 @@ AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
|
|||
/******************************************************************************
|
||||
* AntiMoniker_CommonPrefixWith
|
||||
******************************************************************************/
|
||||
static HRESULT WINAPI
|
||||
AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
|
||||
static HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker *iface, IMoniker *other, IMoniker **prefix)
|
||||
{
|
||||
DWORD mkSys;
|
||||
AntiMonikerImpl *moniker = impl_from_IMoniker(iface), *other_moniker;
|
||||
HRESULT hr;
|
||||
|
||||
IMoniker_IsSystemMoniker(pmkOther,&mkSys);
|
||||
TRACE("%p, %p, %p.\n", iface, other, prefix);
|
||||
|
||||
if(mkSys==MKSYS_ANTIMONIKER){
|
||||
other_moniker = unsafe_impl_from_IMoniker(other);
|
||||
if (other_moniker)
|
||||
{
|
||||
if (moniker->count <= other_moniker->count)
|
||||
{
|
||||
*prefix = iface;
|
||||
hr = moniker->count == other_moniker->count ? MK_S_US : MK_S_ME;
|
||||
}
|
||||
else
|
||||
{
|
||||
*prefix = other;
|
||||
hr = MK_S_HIM;
|
||||
}
|
||||
|
||||
IMoniker_AddRef(iface);
|
||||
|
||||
*ppmkPrefix=iface;
|
||||
|
||||
IMoniker_AddRef(iface);
|
||||
|
||||
return MK_S_US;
|
||||
IMoniker_AddRef(*prefix);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
return MonikerCommonPrefixWith(iface,pmkOther,ppmkPrefix);
|
||||
|
||||
return MonikerCommonPrefixWith(iface, other, prefix);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -2430,8 +2430,6 @@ todo_wine
|
|||
hr = IMoniker_IsEqual(moniker, NULL);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
IStream_Release(stream);
|
||||
|
||||
/* Reduce() */
|
||||
hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, &reduced);
|
||||
ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#x.\n", hr);
|
||||
|
@ -2453,6 +2451,70 @@ todo_wine
|
|||
todo_wine
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
/* CommonPrefixWith() */
|
||||
stream_write_dword(stream, 0);
|
||||
|
||||
hr = IMoniker_Load(moniker, stream);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
|
||||
ok(hr == MK_S_ME, "Unexpected hr %#x.\n", hr);
|
||||
ok(moniker3 == moniker, "Unexpected prefix moniker.\n");
|
||||
IMoniker_Release(moniker3);
|
||||
|
||||
hr = IMoniker_CommonPrefixWith(moniker2, moniker, &moniker3);
|
||||
ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr);
|
||||
ok(moniker3 == moniker, "Unexpected prefix moniker.\n");
|
||||
IMoniker_Release(moniker3);
|
||||
|
||||
stream_write_dword(stream, 10);
|
||||
|
||||
hr = IMoniker_Load(moniker, stream);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
stream_write_dword(stream, 5);
|
||||
|
||||
hr = IMoniker_Load(moniker2, stream);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
|
||||
ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr);
|
||||
ok(moniker3 == moniker2, "Unexpected prefix moniker.\n");
|
||||
IMoniker_Release(moniker3);
|
||||
|
||||
hr = IMoniker_CommonPrefixWith(moniker2, moniker, &moniker3);
|
||||
ok(hr == MK_S_ME, "Unexpected hr %#x.\n", hr);
|
||||
ok(moniker3 == moniker2, "Unexpected prefix moniker.\n");
|
||||
IMoniker_Release(moniker3);
|
||||
|
||||
/* Now same length, 0 or 2 */
|
||||
stream_write_dword(stream, 0);
|
||||
hr = IMoniker_Load(moniker, stream);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
stream_write_dword(stream, 0);
|
||||
hr = IMoniker_Load(moniker2, stream);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
|
||||
ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr);
|
||||
ok(moniker3 == moniker, "Unexpected prefix moniker.\n");
|
||||
IMoniker_Release(moniker3);
|
||||
|
||||
stream_write_dword(stream, 2);
|
||||
hr = IMoniker_Load(moniker, stream);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
stream_write_dword(stream, 2);
|
||||
hr = IMoniker_Load(moniker2, stream);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
|
||||
ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr);
|
||||
ok(moniker3 == moniker, "Unexpected prefix moniker.\n");
|
||||
IMoniker_Release(moniker3);
|
||||
|
||||
IStream_Release(stream);
|
||||
IBindCtx_Release(bindctx);
|
||||
IMoniker_Release(moniker);
|
||||
IMoniker_Release(moniker2);
|
||||
|
|
Loading…
Reference in New Issue