Commit 828a0ae6 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole32: Remove explicit type check in CommonPrefixWith() for item moniker.

parent 1a6659e8
......@@ -753,31 +753,19 @@ static HRESULT WINAPI ItemMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
return CreateAntiMoniker(ppmk);
}
/******************************************************************************
* ItemMoniker_CommonPrefixWith
******************************************************************************/
static HRESULT WINAPI ItemMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
static HRESULT WINAPI ItemMonikerImpl_CommonPrefixWith(IMoniker *iface, IMoniker *other,
IMoniker **prefix)
{
DWORD mkSys;
TRACE("(%p,%p)\n", pmkOther, ppmkPrefix);
IMoniker_IsSystemMoniker(pmkOther,&mkSys);
/* If the other moniker is an item moniker that is equal to this moniker, this method sets *ppmkPrefix */
/* to this moniker and returns MK_S_US */
if((mkSys==MKSYS_ITEMMONIKER) && (IMoniker_IsEqual(iface,pmkOther)==S_OK) ){
*ppmkPrefix=iface;
TRACE("%p, %p, %p\n", iface, other, prefix);
if (IMoniker_IsEqual(iface, other) == S_OK)
{
*prefix = iface;
IMoniker_AddRef(iface);
return MK_S_US;
}
else
/* otherwise, the method calls the MonikerCommonPrefixWith function. This function correctly handles */
/* the case where the other moniker is a generic composite. */
return MonikerCommonPrefixWith(iface,pmkOther,ppmkPrefix);
return MonikerCommonPrefixWith(iface, other, prefix);
}
/******************************************************************************
......
......@@ -2276,7 +2276,7 @@ static void test_item_moniker(void)
"Moniker_IsRunning",
NULL
};
IMoniker *moniker, *moniker2, *reduced, *anti, *inverse;
IMoniker *moniker, *moniker2, *moniker3, *reduced, *anti, *inverse;
DWORD i, hash, eaten, cookie;
HRESULT hr;
IBindCtx *bindctx;
......@@ -2611,6 +2611,34 @@ todo_wine
IMoniker_Release(anti);
IMoniker_Release(moniker);
/* CommonPrefixWith */
hr = CreateItemMoniker(L"!", L"Item", &moniker);
ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
hr = CreateItemMoniker(L"#", L"Item", &moniker2);
ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr);
ok(moniker3 == moniker, "Unexpected object.\n");
IMoniker_Release(moniker3);
IMoniker_Release(moniker2);
hr = CreateItemMoniker(L"!", L"Item2", &moniker2);
ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
moniker3 = (void *)0xdeadbeef;
hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
todo_wine
{
ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr);
ok(!moniker3, "Unexpected object.\n");
}
IMoniker_Release(moniker2);
IMoniker_Release(moniker);
}
static void stream_write_dword(IStream *stream, DWORD value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment