Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comsvcs/main.c | 10 ++++++++-- dlls/comsvcs/tests/comsvcs.c | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/dlls/comsvcs/main.c b/dlls/comsvcs/main.c index 827a6e8e5e..0f287a681f 100644 --- a/dlls/comsvcs/main.c +++ b/dlls/comsvcs/main.c @@ -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, diff --git a/dlls/comsvcs/tests/comsvcs.c b/dlls/comsvcs/tests/comsvcs.c index 63db25bed2..4d37b60eb9 100644 --- a/dlls/comsvcs/tests/comsvcs.c +++ b/dlls/comsvcs/tests/comsvcs.c @@ -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);