Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/compositemoniker.c | 14 ++++--- dlls/ole32/tests/moniker.c | 79 ++++++++++++++++++++++++++++++++++- 2 files changed, 85 insertions(+), 8 deletions(-)
diff --git a/dlls/ole32/compositemoniker.c b/dlls/ole32/compositemoniker.c index 4451f0daae6..77e1e8aff35 100644 --- a/dlls/ole32/compositemoniker.c +++ b/dlls/ole32/compositemoniker.c @@ -1023,17 +1023,19 @@ static HRESULT WINAPI CompositeMonikerImpl_GetDisplayName(IMoniker *iface, IBind { CompositeMonikerImpl *moniker = impl_from_IMoniker(iface); WCHAR *left_name = NULL, *right_name = NULL; + HRESULT hr;
TRACE("%p, %p, %p, %p\n", iface, pbc, pmkToLeft, displayname);
- if (!displayname) - return E_POINTER; - - if (!moniker->comp_count) + if (!pbc || !displayname || !moniker->comp_count) return E_INVALIDARG;
- IMoniker_GetDisplayName(moniker->left, pbc, NULL, &left_name); - IMoniker_GetDisplayName(moniker->right, pbc, NULL, &right_name); + if (FAILED(hr = IMoniker_GetDisplayName(moniker->left, pbc, NULL, &left_name))) return hr; + if (FAILED(hr = IMoniker_GetDisplayName(moniker->right, pbc, NULL, &right_name))) + { + CoTaskMemFree(left_name); + return hr; + }
if (!(*displayname = CoTaskMemAlloc((lstrlenW(left_name) + lstrlenW(right_name) + 1) * sizeof(WCHAR)))) { diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 795d8750d05..fcd8dd8310d 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -145,6 +145,38 @@ static IMoniker *create_antimoniker(DWORD level) return moniker; }
+static HRESULT WINAPI pointer_moniker_obj_QueryInterface(IUnknown *iface, + REFIID riid, void **obj) +{ + if (IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + return S_OK; + } + + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI pointer_moniker_obj_AddRef(IUnknown *iface) +{ + return 2; +} + +static ULONG WINAPI pointer_moniker_obj_Release(IUnknown *iface) +{ + return 1; +} + +static const IUnknownVtbl pointer_moniker_obj_vtbl = +{ + pointer_moniker_obj_QueryInterface, + pointer_moniker_obj_AddRef, + pointer_moniker_obj_Release, +}; + +static IUnknown pm_obj = { &pointer_moniker_obj_vtbl }; + static HRESULT create_moniker_parse_desc(const char *desc, unsigned int *eaten, IMoniker **moniker) { @@ -163,6 +195,9 @@ static HRESULT create_moniker_parse_desc(const char *desc, unsigned int *eaten, *eaten = 2; *moniker = create_antimoniker(desc[1] - '0'); return S_OK; + case 'P': + *eaten = 1; + return CreatePointerMoniker(&pm_obj, moniker); case 'C': *eaten = 1; desc++; @@ -860,7 +895,7 @@ static void test_ROT(void) '1','9','0','3','-','4','A','A','E','-','B','1','A','F','-', '2','0','4','6','E','5','8','6','C','9','2','5',0}; HRESULT hr; - IMoniker *pMoniker = NULL; + IMoniker *pMoniker = NULL, *moniker; struct test_moniker *test_moniker; IRunningObjectTable *pROT = NULL; struct test_factory factory; @@ -988,6 +1023,25 @@ static void test_ROT(void) IMoniker_Release(pMoniker); IMoniker_Release(&test_moniker->IMoniker_iface);
+ /* Pointer moniker does not implement IROTData or display name */ + hr = CreatePointerMoniker(NULL, &pMoniker); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)&factory.IClassFactory_iface, + pMoniker, &dwCookie); +todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + IMoniker_Release(pMoniker); + + hr = create_moniker_from_desc("I1", &moniker); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = CreatePointerMoniker((IUnknown *)moniker, &pMoniker); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)&factory.IClassFactory_iface, + pMoniker, &dwCookie); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + IMoniker_Release(pMoniker); + IMoniker_Release(moniker); + IRunningObjectTable_Release(pROT); }
@@ -3537,6 +3591,23 @@ todo_wine IMoniker_Release(&m->IMoniker_iface); IMoniker_Release(&m2->IMoniker_iface);
+ /* Display name */ + + /* One component does not support it. */ + hr = create_moniker_from_desc("CPI1", &moniker); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &str); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &str); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + IMoniker_Release(moniker); + IBindCtx_Release(bindctx); }
@@ -3616,7 +3687,11 @@ todo_wine ok_ole_success(hr, CreateBindCtx);
hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &display_name); - ok(hr == E_NOTIMPL, "IMoniker_GetDisplayName should have returned E_NOTIMPL instead of 0x%08x\n", hr); + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + + hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &display_name); +todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
IBindCtx_Release(bindctx);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/pointermoniker.c | 18 ++++++++---------- dlls/ole32/tests/moniker.c | 6 +++++- 2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/dlls/ole32/pointermoniker.c b/dlls/ole32/pointermoniker.c index aa4a01d9e75..051d42aca6d 100644 --- a/dlls/ole32/pointermoniker.c +++ b/dlls/ole32/pointermoniker.c @@ -380,19 +380,17 @@ static HRESULT WINAPI PointerMonikerImpl_RelativePathTo(IMoniker *iface, IMonike return other ? E_NOTIMPL : E_INVALIDARG; }
-/****************************************************************************** - * PointerMoniker_GetDisplayName - ******************************************************************************/ -static HRESULT WINAPI -PointerMonikerImpl_GetDisplayName(IMoniker* iface, IBindCtx* pbc, - IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName) +static HRESULT WINAPI PointerMonikerImpl_GetDisplayName(IMoniker *iface, IBindCtx *pbc, + IMoniker *toleft, LPOLESTR *name) { - TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName); + TRACE("%p, %p, %p, %p.\n", iface, pbc, toleft, name);
- if (ppszDisplayName==NULL) - return E_POINTER; + if (!name || !pbc) + { + if (name) *name = NULL; + return E_INVALIDARG; + }
- *ppszDisplayName = NULL; return E_NOTIMPL; }
diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index fcd8dd8310d..a7c0714a5d7 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -3689,9 +3689,13 @@ todo_wine hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &display_name); ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+ hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + display_name = (void *)0xdeadbeef; hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &display_name); -todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + ok(!display_name, "Unexpected pointer.\n");
IBindCtx_Release(bindctx);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/tests/moniker.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index a7c0714a5d7..2d7f0789924 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -3173,6 +3173,7 @@ static void test_generic_composite_moniker(void) IUnknown *unknown; IROTData *rotdata; IMarshal *marshal; + BYTE buffer[100]; IStream *stream; unsigned int i; FILETIME ft; @@ -3606,6 +3607,17 @@ todo_wine hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &str); ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+ /* Comparison data, pointer component does not support it. */ + hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rotdata); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + len = 0; + hr = IROTData_GetComparisonData(rotdata, buffer, sizeof(buffer), &len); +todo_wine { + ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr); + ok(!len, "Unexpected length %u.\n", len); +} + IROTData_Release(rotdata); + IMoniker_Release(moniker);
IBindCtx_Release(bindctx);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/compositemoniker.c | 93 +++++++++++------------------------ dlls/ole32/tests/moniker.c | 9 ++++ 2 files changed, 39 insertions(+), 63 deletions(-)
diff --git a/dlls/ole32/compositemoniker.c b/dlls/ole32/compositemoniker.c index 77e1e8aff35..df9b23c515d 100644 --- a/dlls/ole32/compositemoniker.c +++ b/dlls/ole32/compositemoniker.c @@ -612,82 +612,49 @@ static HRESULT WINAPI CompositeMonikerImpl_Hash(IMoniker *iface, DWORD *hash) return hr; }
-/****************************************************************************** - * CompositeMoniker_IsRunning - ******************************************************************************/ -static HRESULT WINAPI -CompositeMonikerImpl_IsRunning(IMoniker* iface, IBindCtx* pbc, - IMoniker* pmkToLeft, IMoniker* pmkNewlyRunning) +static HRESULT WINAPI CompositeMonikerImpl_IsRunning(IMoniker *iface, IBindCtx *pbc, + IMoniker *toleft, IMoniker *newly_running) { - IRunningObjectTable* rot; - HRESULT res; - IMoniker *tempMk,*antiMk,*rightMostMk; - IEnumMoniker *enumMoniker; - - TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning); - - /* If pmkToLeft is non-NULL, this method composes pmkToLeft with this moniker and calls IsRunning on the result.*/ - if (pmkToLeft!=NULL){ + CompositeMonikerImpl *moniker = impl_from_IMoniker(iface); + IMoniker *c, *left, *rightmost; + IRunningObjectTable *rot; + HRESULT hr;
- CreateGenericComposite(pmkToLeft,iface,&tempMk); + TRACE("%p, %p, %p, %p.\n", iface, pbc, toleft, newly_running);
- res = IMoniker_IsRunning(tempMk,pbc,NULL,pmkNewlyRunning); + if (!pbc) + return E_INVALIDARG;
- IMoniker_Release(tempMk); + if (toleft) + { + if (SUCCEEDED(hr = CreateGenericComposite(toleft, iface, &c))) + { + hr = IMoniker_IsRunning(c, pbc, NULL, newly_running); + IMoniker_Release(c); + }
- return res; + return hr; } - else - /* If pmkToLeft is NULL, this method returns S_OK if pmkNewlyRunning is non-NULL and is equal */ - /* to this moniker */
- if (pmkNewlyRunning!=NULL) + if (newly_running) + return IMoniker_IsEqual(iface, newly_running);
- if (IMoniker_IsEqual(iface,pmkNewlyRunning)==S_OK) - return S_OK; - - else - return S_FALSE; - - else{ - - if (pbc==NULL) - return E_INVALIDARG; - - /* If pmkToLeft and pmkNewlyRunning are both NULL, this method checks the ROT to see whether */ - /* the moniker is running. If so, the method returns S_OK; otherwise, it recursively calls */ - /* IMoniker::IsRunning on the rightmost component of the composite, passing the remainder of */ - /* the composite as the pmkToLeft parameter for that call. */ - - res=IBindCtx_GetRunningObjectTable(pbc,&rot); - - if (FAILED(res)) - return res; - - res = IRunningObjectTable_IsRunning(rot,iface); - IRunningObjectTable_Release(rot); - - if(res==S_OK) - return S_OK; - - else{ + if (FAILED(hr = IBindCtx_GetRunningObjectTable(pbc, &rot))) + return hr;
- IMoniker_Enum(iface,FALSE,&enumMoniker); - IEnumMoniker_Next(enumMoniker,1,&rightMostMk,NULL); - IEnumMoniker_Release(enumMoniker); + hr = IRunningObjectTable_IsRunning(rot, iface); + IRunningObjectTable_Release(rot); + if (hr == S_OK) return S_OK;
- res=CreateAntiMoniker(&antiMk); - res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); - IMoniker_Release(antiMk); + if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost))) + return hr;
- res=IMoniker_IsRunning(rightMostMk,pbc,tempMk,pmkNewlyRunning); + hr = IMoniker_IsRunning(rightmost, pbc, left, NULL);
- IMoniker_Release(tempMk); - IMoniker_Release(rightMostMk); + IMoniker_Release(left); + IMoniker_Release(rightmost);
- return res; - } - } + return hr; }
static HRESULT WINAPI CompositeMonikerImpl_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc, diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 2d7f0789924..ea58c09356e 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -3273,6 +3273,15 @@ todo_wine hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL); ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+ hr = IMoniker_IsRunning(moniker, bindctx, NULL, moniker); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMoniker_IsRunning(moniker, bindctx, moniker1, moniker); + ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr); + + hr = IMoniker_IsRunning(moniker, NULL, moniker1, moniker); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime); ok(hr == MK_E_NOTBINDABLE, "IMoniker_GetTimeOfLastChange should return MK_E_NOTBINDABLE, not 0x%08x\n", hr);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/compositemoniker.c | 58 ++++++++++++++--------------------- 1 file changed, 23 insertions(+), 35 deletions(-)
diff --git a/dlls/ole32/compositemoniker.c b/dlls/ole32/compositemoniker.c index df9b23c515d..c6d0d3c47a6 100644 --- a/dlls/ole32/compositemoniker.c +++ b/dlls/ole32/compositemoniker.c @@ -372,52 +372,40 @@ static HRESULT WINAPI CompositeMonikerImpl_BindToObject(IMoniker *iface, IBindCt return hr; }
-/****************************************************************************** - * CompositeMoniker_BindToStorage - ******************************************************************************/ -static HRESULT WINAPI -CompositeMonikerImpl_BindToStorage(IMoniker* iface, IBindCtx* pbc, - IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult) +static HRESULT WINAPI CompositeMonikerImpl_BindToStorage(IMoniker *iface, IBindCtx *pbc, + IMoniker *toleft, REFIID riid, void **result) { - HRESULT res; - IMoniker *tempMk,*antiMk,*rightMostMk,*leftMk; - IEnumMoniker *enumMoniker; + CompositeMonikerImpl *moniker = impl_from_IMoniker(iface); + IMoniker *left, *rightmost, *composed_left; + HRESULT hr;
- TRACE("(%p,%p,%p,%s,%p)\n",iface,pbc,pmkToLeft,debugstr_guid(riid),ppvResult); + TRACE("%p, %p, %p, %s, %p.\n", iface, pbc, toleft, debugstr_guid(riid), result);
- *ppvResult=0; + *result = NULL;
- /* This method recursively calls BindToStorage on the rightmost component of the composite, */ - /* passing the rest of the composite as the pmkToLeft parameter for that call. */ + if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost))) + return hr;
- if (pmkToLeft) + if (toleft) { - res = IMoniker_ComposeWith(pmkToLeft, iface, FALSE, &leftMk); - if (FAILED(res)) return res; + hr = compose_with(toleft, left, &composed_left); } else - leftMk = iface; - - IMoniker_Enum(iface, FALSE, &enumMoniker); - IEnumMoniker_Next(enumMoniker, 1, &rightMostMk, NULL); - IEnumMoniker_Release(enumMoniker); - - res = CreateAntiMoniker(&antiMk); - if (FAILED(res)) return res; - res = IMoniker_ComposeWith(leftMk, antiMk, 0, &tempMk); - if (FAILED(res)) return res; - IMoniker_Release(antiMk); - - res = IMoniker_BindToStorage(rightMostMk, pbc, tempMk, riid, ppvResult); - - IMoniker_Release(tempMk); + { + composed_left = left; + IMoniker_AddRef(composed_left); + }
- IMoniker_Release(rightMostMk); + if (SUCCEEDED(hr)) + { + hr = IMoniker_BindToStorage(rightmost, pbc, composed_left, riid, result); + IMoniker_Release(composed_left); + }
- if (pmkToLeft) - IMoniker_Release(leftMk); + IMoniker_Release(rightmost); + IMoniker_Release(left);
- return res; + return hr; }
/******************************************************************************
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/compositemoniker.c | 89 +++++++++++------------------------ dlls/ole32/tests/moniker.c | 19 +++++++- 2 files changed, 46 insertions(+), 62 deletions(-)
diff --git a/dlls/ole32/compositemoniker.c b/dlls/ole32/compositemoniker.c index c6d0d3c47a6..80a1a675766 100644 --- a/dlls/ole32/compositemoniker.c +++ b/dlls/ole32/compositemoniker.c @@ -408,76 +408,43 @@ static HRESULT WINAPI CompositeMonikerImpl_BindToStorage(IMoniker *iface, IBindC return hr; }
-/****************************************************************************** - * CompositeMoniker_Reduce - ******************************************************************************/ -static HRESULT WINAPI -CompositeMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar, - IMoniker** ppmkToLeft, IMoniker** ppmkReduced) +static HRESULT WINAPI CompositeMonikerImpl_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD howfar, + IMoniker **toleft, IMoniker **reduced) { - HRESULT res; - IMoniker *tempMk,*antiMk,*rightMostMk,*leftReducedComposedMk,*rightMostReducedMk; - IEnumMoniker *enumMoniker; - - TRACE("(%p,%p,%d,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced); - - if (ppmkReduced==NULL) - return E_POINTER; - - /* This method recursively calls Reduce for each of its component monikers. */ - - if (ppmkToLeft==NULL){ + CompositeMonikerImpl *moniker = impl_from_IMoniker(iface); + IMoniker *m, *reduced_left, *reduced_right; + BOOL was_reduced; + HRESULT hr;
- IMoniker_Enum(iface,FALSE,&enumMoniker); - IEnumMoniker_Next(enumMoniker,1,&rightMostMk,NULL); - IEnumMoniker_Release(enumMoniker); + TRACE("%p, %p, %d, %p, %p.\n", iface, pbc, howfar, toleft, reduced);
- CreateAntiMoniker(&antiMk); - IMoniker_ComposeWith(iface,antiMk,0,&tempMk); - IMoniker_Release(antiMk); + if (!pbc || !reduced) + return E_INVALIDARG;
- res = IMoniker_Reduce(rightMostMk,pbc,dwReduceHowFar,&tempMk, ppmkReduced); - IMoniker_Release(tempMk); - IMoniker_Release(rightMostMk); + if (FAILED(hr = IMoniker_Reduce(moniker->left, pbc, howfar, NULL, &reduced_left))) + return hr;
- return res; + m = moniker->left; + if (FAILED(hr = IMoniker_Reduce(moniker->right, pbc, howfar, &m, &reduced_right))) + { + IMoniker_Release(reduced_left); + return hr; } - else if (*ppmkToLeft==NULL)
- return IMoniker_Reduce(iface,pbc,dwReduceHowFar,NULL,ppmkReduced); - - else{ - - /* separate the composite moniker in to left and right moniker */ - IMoniker_Enum(iface,FALSE,&enumMoniker); - IEnumMoniker_Next(enumMoniker,1,&rightMostMk,NULL); - IEnumMoniker_Release(enumMoniker); - - CreateAntiMoniker(&antiMk); - IMoniker_ComposeWith(iface,antiMk,0,&tempMk); - IMoniker_Release(antiMk); - - /* If any of the components reduces itself, the method returns S_OK and passes back a composite */ - /* of the reduced components */ - if (IMoniker_Reduce(rightMostMk,pbc,dwReduceHowFar,NULL,&rightMostReducedMk) && - IMoniker_Reduce(rightMostMk,pbc,dwReduceHowFar,&tempMk,&leftReducedComposedMk) ){ - IMoniker_Release(tempMk); - IMoniker_Release(rightMostMk); - - return CreateGenericComposite(leftReducedComposedMk,rightMostReducedMk,ppmkReduced); - } - else{ - /* If no reduction occurred, the method passes back the same moniker and returns MK_S_REDUCED_TO_SELF.*/ - IMoniker_Release(tempMk); - IMoniker_Release(rightMostMk); - - IMoniker_AddRef(iface); + if ((was_reduced = (reduced_left != moniker->left || reduced_right != moniker->right))) + { + hr = CreateGenericComposite(reduced_left, reduced_right, reduced); + } + else + { + *reduced = iface; + IMoniker_AddRef(*reduced); + }
- *ppmkReduced=iface; + IMoniker_Release(reduced_left); + IMoniker_Release(reduced_right);
- return MK_S_REDUCED_TO_SELF; - } - } + return was_reduced ? hr : MK_S_REDUCED_TO_SELF; }
static HRESULT WINAPI CompositeMonikerImpl_ComposeWith(IMoniker *iface, IMoniker *right, diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index ea58c09356e..7e4a42a0ee6 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -3439,7 +3439,6 @@ todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, moniker1, &ft); -todo_wine ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#x.\n", hr);
hr = IRunningObjectTable_Revoke(rot, cookie); @@ -3629,6 +3628,24 @@ todo_wine {
IMoniker_Release(moniker);
+ /* Reduce() */ + hr = create_moniker_from_desc("CI1I2", &moniker); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + hr = IMoniker_Reduce(moniker, bindctx, MKRREDUCE_ALL, NULL, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, &moniker2); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = IMoniker_Reduce(moniker, bindctx, MKRREDUCE_ALL, NULL, &moniker2); + ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#x.\n", hr); + ok(moniker2 == moniker, "Unexpected object.\n"); + IMoniker_Release(moniker2); + + IMoniker_Release(moniker); + IBindCtx_Release(bindctx); }