Commit 015ad98f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comsvcs: Add Reduce() for "new" moniker.

parent 0fbf3688
......@@ -600,9 +600,15 @@ static HRESULT WINAPI new_moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc,
static HRESULT WINAPI new_moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD flags, IMoniker **ppmkToLeft,
IMoniker **ret)
{
FIXME("%p, %p, %d, %p, %p.\n", iface, pbc, flags, ppmkToLeft, ret);
TRACE("%p, %p, %d, %p, %p.\n", iface, pbc, flags, ppmkToLeft, ret);
return E_NOTIMPL;
if (!ret)
return E_POINTER;
*ret = iface;
IMoniker_AddRef(iface);
return MK_S_REDUCED_TO_SELF;
}
static HRESULT WINAPI new_moniker_ComposeWith(IMoniker *iface, IMoniker *mkRight, BOOL fOnlyIfNotGeneric,
......
......@@ -295,7 +295,7 @@ static void create_dispenser(void)
static void test_new_moniker(void)
{
IMoniker *moniker, *moniker2, *inverse, *class_moniker;
IMoniker *moniker, *moniker2, *inverse, *class_moniker, *moniker_left;
IRunningObjectTable *rot;
IUnknown *obj, *obj2;
BIND_OPTS2 bind_opts;
......@@ -356,6 +356,22 @@ static void test_new_moniker(void)
IMoniker_Release(class_moniker);
/* Reducing. */
moniker_left = (void *)0xdeadbeef;
hr = IMoniker_Reduce(moniker, bindctx, MKRREDUCE_ONE, &moniker_left, &moniker2);
ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#x.\n", hr);
ok(moniker_left == (void *)0xdeadbeef, "Unexpected left moniker.\n");
ok(moniker2 == moniker, "Unexpected returned moniker.\n");
IMoniker_Release(moniker2);
hr = IMoniker_Reduce(moniker, bindctx, MKRREDUCE_ONE, NULL, &moniker2);
ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#x.\n", hr);
ok(moniker2 == moniker, "Unexpected returned moniker.\n");
IMoniker_Release(moniker2);
hr = IMoniker_Reduce(moniker, bindctx, MKRREDUCE_ONE, NULL, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
/* Hashing */
hash = 0;
hr = IMoniker_Hash(moniker, &hash);
......
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