Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/itemmoniker.c | 76 +++++------------------------ dlls/ole32/tests/moniker.c | 97 ++++++++++++++++++++++---------------- 2 files changed, 68 insertions(+), 105 deletions(-)
diff --git a/dlls/ole32/itemmoniker.c b/dlls/ole32/itemmoniker.c index c42cc75c224..770b042aac7 100644 --- a/dlls/ole32/itemmoniker.c +++ b/dlls/ole32/itemmoniker.c @@ -511,77 +511,23 @@ static HRESULT WINAPI ItemMonikerImpl_Reduce(IMoniker* iface,
return MK_S_REDUCED_TO_SELF; } -/****************************************************************************** - * ItemMoniker_ComposeWith - ******************************************************************************/ -static HRESULT WINAPI ItemMonikerImpl_ComposeWith(IMoniker* iface, - IMoniker* pmkRight, - BOOL fOnlyIfNotGeneric, - IMoniker** ppmkComposite) -{ - HRESULT res=S_OK; - DWORD mkSys,mkSys2, order; - IEnumMoniker* penumMk=0; - IMoniker *pmostLeftMk=0; - IMoniker* tempMkComposite=0; - - TRACE("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite); - - if ((ppmkComposite==NULL)||(pmkRight==NULL)) - return E_POINTER; - - *ppmkComposite=0; - - if (is_anti_moniker(pmkRight, &order)) - { - return order > 1 ? create_anti_moniker(order - 1, ppmkComposite) : S_OK; - } - else - /* if pmkRight is a composite whose leftmost component is an anti-moniker, */ - /* the returned moniker is the composite after the leftmost anti-moniker is removed. */ - IMoniker_IsSystemMoniker(pmkRight,&mkSys); - if(mkSys==MKSYS_GENERICCOMPOSITE){ - - res=IMoniker_Enum(pmkRight,TRUE,&penumMk); - - if (FAILED(res)) - return res; - - res=IEnumMoniker_Next(penumMk,1,&pmostLeftMk,NULL); - - IMoniker_IsSystemMoniker(pmostLeftMk,&mkSys2);
- if(mkSys2==MKSYS_ANTIMONIKER){ - - IMoniker_Release(pmostLeftMk); +static HRESULT WINAPI ItemMonikerImpl_ComposeWith(IMoniker *iface, IMoniker *right, + BOOL only_if_not_generic, IMoniker **result) +{ + DWORD order;
- tempMkComposite=iface; - IMoniker_AddRef(iface); + TRACE("%p, %p, %d, %p\n", iface, right, only_if_not_generic, result);
- while(IEnumMoniker_Next(penumMk,1,&pmostLeftMk,NULL)==S_OK){ + if (!result || !right) + return E_POINTER;
- res=CreateGenericComposite(tempMkComposite,pmostLeftMk,ppmkComposite); + *result = NULL;
- IMoniker_Release(tempMkComposite); - IMoniker_Release(pmostLeftMk); + if (is_anti_moniker(right, &order)) + return order > 1 ? create_anti_moniker(order - 1, result) : S_OK;
- tempMkComposite=*ppmkComposite; - IMoniker_AddRef(tempMkComposite); - } - return res; - } - else - return CreateGenericComposite(iface,pmkRight,ppmkComposite); - } - /* If pmkRight is not an anti-moniker, the method combines the two monikers into a generic - composite if fOnlyIfNotGeneric is FALSE; if fOnlyIfNotGeneric is TRUE, the method returns - a NULL moniker and a return value of MK_E_NEEDGENERIC */ - else - if (!fOnlyIfNotGeneric) - return CreateGenericComposite(iface,pmkRight,ppmkComposite); - - else - return MK_E_NEEDGENERIC; + return only_if_not_generic ? MK_E_NEEDGENERIC : CreateGenericComposite(iface, right, result); }
/****************************************************************************** diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 4d40dcb6e4b..1b44c80fe45 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -127,6 +127,43 @@ static IMoniker *create_antimoniker(DWORD level) return moniker; }
+static HRESULT create_moniker_from_desc(const char *desc, unsigned int *eaten, + IMoniker **moniker) +{ + IMoniker *left, *right; + WCHAR nameW[3]; + HRESULT hr; + + desc += *eaten; + + switch (*desc) + { + case 'I': + nameW[0] = desc[0]; + nameW[1] = desc[1]; + nameW[2] = 0; + *eaten += 2; + return CreateItemMoniker(L"!", nameW, moniker); + case 'A': + *eaten += 2; + *moniker = create_antimoniker(desc[1] - '0'); + return S_OK; + case 'C': + (*eaten)++; + hr = create_moniker_from_desc(desc, eaten, &left); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = create_moniker_from_desc(desc, eaten, &right); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = CreateGenericComposite(left, right, moniker); + IMoniker_Release(left); + IMoniker_Release(right); + return hr; + default: + ok(0, "Unexpected description %s.\n", desc); + return E_NOTIMPL; + } +} + static SIZE_T round_global_size(SIZE_T size) { static SIZE_T global_size_alignment = -1; @@ -2267,7 +2304,7 @@ static void test_item_moniker(void) "Moniker_IsRunning", NULL }; - IMoniker *moniker, *moniker2, *moniker3, *reduced, *anti, *inverse; + IMoniker *moniker, *moniker2, *moniker3, *reduced, *anti, *inverse, *c; DWORD i, hash, eaten, cookie; HRESULT hr; IBindCtx *bindctx; @@ -2589,7 +2626,7 @@ todo_wine ok(!moniker2, "Unexpected pointer.\n"); IMoniker_Release(anti);
- /* I + A2 -> (A) */ + /* I + A2 -> A */ anti = create_antimoniker(2); hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2); ok(hr == S_OK, "Failed to compose, hr %#x.\n", hr); @@ -2601,6 +2638,24 @@ todo_wine
IMoniker_Release(anti);
+ /* I + (A,A3) -> A3 */ + + /* Simplification has to through generic composite logic, + even when resolved to non-composite, generic composite option has to be enabled. */ + eaten = 0; + hr = create_moniker_from_desc("CA1A3", &eaten, &c); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2); + ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr); + hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER); + hr = IMoniker_Hash(moniker2, &hash); + ok(hr == S_OK, "Failed to get hash, hr %#x.\n", hr); + ok(hash == 0x80000003, "Unexpected hash.\n"); + IMoniker_Release(moniker2); + IMoniker_Release(c); + IMoniker_Release(moniker);
/* CommonPrefixWith */ @@ -2893,43 +2948,6 @@ todo_wine IMoniker_Release(moniker2); }
-static HRESULT create_moniker_from_desc(const char *desc, unsigned int *eaten, - IMoniker **moniker) -{ - IMoniker *left, *right; - WCHAR nameW[3]; - HRESULT hr; - - desc += *eaten; - - switch (*desc) - { - case 'I': - nameW[0] = desc[0]; - nameW[1] = desc[1]; - nameW[2] = 0; - *eaten += 2; - return CreateItemMoniker(L"!", nameW, moniker); - case 'A': - *eaten += 2; - *moniker = create_antimoniker(desc[1] - '0'); - return S_OK; - case 'C': - (*eaten)++; - hr = create_moniker_from_desc(desc, eaten, &left); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - hr = create_moniker_from_desc(desc, eaten, &right); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - hr = CreateGenericComposite(left, right, moniker); - IMoniker_Release(left); - IMoniker_Release(right); - return hr; - default: - ok(0, "Unexpected description %s.\n", desc); - return E_NOTIMPL; - } -} - static void test_generic_composite_moniker(void) { static const struct simplify_test @@ -3154,7 +3172,6 @@ todo_wine
/* See if non-generic composition is possible */ hr = IMoniker_ComposeWith(moniker1, moniker, TRUE, &moniker2); -todo_wine ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr);
hr = IBindCtx_GetRunningObjectTable(bindctx, &rot);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/pointermoniker.c | 79 ++++++------------------------------- dlls/ole32/tests/moniker.c | 33 +++++++++++++++- 2 files changed, 43 insertions(+), 69 deletions(-)
diff --git a/dlls/ole32/pointermoniker.c b/dlls/ole32/pointermoniker.c index 34692c4965b..14cf8af9eaa 100644 --- a/dlls/ole32/pointermoniker.c +++ b/dlls/ole32/pointermoniker.c @@ -241,80 +241,23 @@ PointerMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar,
return MK_S_REDUCED_TO_SELF; } -/****************************************************************************** - * PointerMoniker_ComposeWith - ******************************************************************************/ -static HRESULT WINAPI -PointerMonikerImpl_ComposeWith(IMoniker* iface, IMoniker* pmkRight, - BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite) -{ - - HRESULT res=S_OK; - DWORD mkSys,mkSys2, order; - IEnumMoniker* penumMk=0; - IMoniker *pmostLeftMk=0; - IMoniker* tempMkComposite=0; - - TRACE("(%p,%d,%p)\n", pmkRight, fOnlyIfNotGeneric, ppmkComposite);
- if ((ppmkComposite==NULL)||(pmkRight==NULL)) - return E_POINTER; - - *ppmkComposite=0; - - if (is_anti_moniker(pmkRight, &order)) - { - return order > 1 ? create_anti_moniker(order - 1, ppmkComposite) : S_OK; - } - else - { - /* if pmkRight is a composite whose leftmost component is an anti-moniker, */ - /* the returned moniker is the composite after the leftmost anti-moniker is removed. */ - IMoniker_IsSystemMoniker(pmkRight,&mkSys); - - if(mkSys==MKSYS_GENERICCOMPOSITE){ - - res=IMoniker_Enum(pmkRight,TRUE,&penumMk); - - if (FAILED(res)) - return res; - - res=IEnumMoniker_Next(penumMk,1,&pmostLeftMk,NULL); - - IMoniker_IsSystemMoniker(pmostLeftMk,&mkSys2); - - if(mkSys2==MKSYS_ANTIMONIKER){ - - IMoniker_Release(pmostLeftMk); - - tempMkComposite=iface; - IMoniker_AddRef(iface); +static HRESULT WINAPI PointerMonikerImpl_ComposeWith(IMoniker *iface, IMoniker *right, + BOOL only_if_not_generic, IMoniker **result) +{ + DWORD order;
- while(IEnumMoniker_Next(penumMk,1,&pmostLeftMk,NULL)==S_OK){ + TRACE("%p, %p, %d, %p.\n", iface, right, only_if_not_generic, result);
- res=CreateGenericComposite(tempMkComposite,pmostLeftMk,ppmkComposite); + if (!result || !right) + return E_POINTER;
- IMoniker_Release(tempMkComposite); - IMoniker_Release(pmostLeftMk); + *result = NULL;
- tempMkComposite=*ppmkComposite; - IMoniker_AddRef(tempMkComposite); - } - return res; - } - else - return CreateGenericComposite(iface,pmkRight,ppmkComposite); - } - /* If pmkRight is not an anti-moniker, the method combines the two monikers into a generic - composite if fOnlyIfNotGeneric is FALSE; if fOnlyIfNotGeneric is TRUE, the method returns - a NULL moniker and a return value of MK_E_NEEDGENERIC */ - else - if (!fOnlyIfNotGeneric) - return CreateGenericComposite(iface,pmkRight,ppmkComposite); + if (is_anti_moniker(right, &order)) + return order > 1 ? create_anti_moniker(order - 1, result) : S_OK;
- else - return MK_E_NEEDGENERIC; - } + return only_if_not_generic ? MK_E_NEEDGENERIC : CreateGenericComposite(iface, right, result); }
/****************************************************************************** diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 1b44c80fe45..272c4e4c568 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -3213,7 +3213,7 @@ todo_wine
static void test_pointer_moniker(void) { - IMoniker *moniker, *moniker2, *prefix, *inverse, *anti; + IMoniker *moniker, *moniker2, *prefix, *inverse, *anti, *c; struct test_factory factory; IEnumMoniker *enummoniker; DWORD hash, size; @@ -3224,6 +3224,7 @@ static void test_pointer_moniker(void) IStream *stream; IROTData *rotdata; LPOLESTR display_name; + unsigned int eaten; IMarshal *marshal; LARGE_INTEGER pos; CLSID clsid; @@ -3412,6 +3413,36 @@ static void test_pointer_moniker(void)
IMoniker_Release(anti);
+ /* Simplification has to through generic composite logic, + even when resolved to non-composite, generic composite option has to be enabled. */ + + /* P + (A,A3) -> A3 */ + eaten = 0; + hr = create_moniker_from_desc("CA1A3", &eaten, &c); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2); + ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr); + hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER); + hr = IMoniker_Hash(moniker2, &hash); + ok(hr == S_OK, "Failed to get hash, hr %#x.\n", hr); + ok(hash == 0x80000003, "Unexpected hash.\n"); + IMoniker_Release(moniker2); + IMoniker_Release(c); + + /* P + (A,I) -> I */ + eaten = 0; + hr = create_moniker_from_desc("CA1I1", &eaten, &c); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2); + ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr); + hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + TEST_MONIKER_TYPE(moniker2, MKSYS_ITEMMONIKER); + IMoniker_Release(moniker2); + IMoniker_Release(c); + IMoniker_Release(moniker); }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/classmoniker.c | 78 ++++++--------------------------------- 1 file changed, 11 insertions(+), 67 deletions(-)
diff --git a/dlls/ole32/classmoniker.c b/dlls/ole32/classmoniker.c index 03c7f773e29..8fe60c6ba71 100644 --- a/dlls/ole32/classmoniker.c +++ b/dlls/ole32/classmoniker.c @@ -298,79 +298,23 @@ static HRESULT WINAPI ClassMoniker_Reduce(IMoniker* iface,
return MK_S_REDUCED_TO_SELF; } -/****************************************************************************** - * ClassMoniker_ComposeWith - ******************************************************************************/ -static HRESULT WINAPI ClassMoniker_ComposeWith(IMoniker* iface, - IMoniker* pmkRight, - BOOL fOnlyIfNotGeneric, - IMoniker** ppmkComposite) -{ - HRESULT res=S_OK; - DWORD mkSys,mkSys2; - IEnumMoniker* penumMk=0; - IMoniker *pmostLeftMk=0; - IMoniker* tempMkComposite=0; - - TRACE("(%p,%d,%p)\n", pmkRight, fOnlyIfNotGeneric, ppmkComposite); - - if ((ppmkComposite==NULL)||(pmkRight==NULL)) - return E_POINTER; - - *ppmkComposite=0; - - IMoniker_IsSystemMoniker(pmkRight,&mkSys); - - /* If pmkRight is an anti-moniker, the returned moniker is NULL */ - if(mkSys==MKSYS_ANTIMONIKER) - return res; - - else - /* if pmkRight is a composite whose leftmost component is an anti-moniker, */ - /* the returned moniker is the composite after the leftmost anti-moniker is removed. */
- if(mkSys==MKSYS_GENERICCOMPOSITE){ - - res=IMoniker_Enum(pmkRight,TRUE,&penumMk); - - if (FAILED(res)) - return res; - - res=IEnumMoniker_Next(penumMk,1,&pmostLeftMk,NULL); - - IMoniker_IsSystemMoniker(pmostLeftMk,&mkSys2); - - if(mkSys2==MKSYS_ANTIMONIKER){ - - IMoniker_Release(pmostLeftMk); - - tempMkComposite=iface; - IMoniker_AddRef(iface); +static HRESULT WINAPI ClassMoniker_ComposeWith(IMoniker *iface, IMoniker *right, + BOOL only_if_not_generic, IMoniker **result) +{ + DWORD order;
- while(IEnumMoniker_Next(penumMk,1,&pmostLeftMk,NULL)==S_OK){ + TRACE("%p, %p, %d, %p.\n", iface, right, only_if_not_generic, result);
- res=CreateGenericComposite(tempMkComposite,pmostLeftMk,ppmkComposite); + if (!result || !right) + return E_POINTER;
- IMoniker_Release(tempMkComposite); - IMoniker_Release(pmostLeftMk); + *result = NULL;
- tempMkComposite=*ppmkComposite; - IMoniker_AddRef(tempMkComposite); - } - return res; - } - else - return CreateGenericComposite(iface,pmkRight,ppmkComposite); - } - /* If pmkRight is not an anti-moniker, the method combines the two monikers into a generic - composite if fOnlyIfNotGeneric is FALSE; if fOnlyIfNotGeneric is TRUE, the method returns - a NULL moniker and a return value of MK_E_NEEDGENERIC */ - else - if (!fOnlyIfNotGeneric) - return CreateGenericComposite(iface,pmkRight,ppmkComposite); + if (is_anti_moniker(right, &order)) + return S_OK;
- else - return MK_E_NEEDGENERIC; + return only_if_not_generic ? MK_E_NEEDGENERIC : CreateGenericComposite(iface, right, result); }
/******************************************************************************
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/tests/moniker.c | 66 +++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 30 deletions(-)
diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 272c4e4c568..6b21a2e732e 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -127,33 +127,41 @@ static IMoniker *create_antimoniker(DWORD level) return moniker; }
-static HRESULT create_moniker_from_desc(const char *desc, unsigned int *eaten, +static HRESULT create_moniker_parse_desc(const char *desc, unsigned int *eaten, IMoniker **moniker) { + unsigned int comp_len = 0; + WCHAR itemnameW[3] = L"Ix"; IMoniker *left, *right; - WCHAR nameW[3]; HRESULT hr;
- desc += *eaten; - switch (*desc) { case 'I': - nameW[0] = desc[0]; - nameW[1] = desc[1]; - nameW[2] = 0; - *eaten += 2; - return CreateItemMoniker(L"!", nameW, moniker); + itemnameW[1] = desc[1]; + *eaten = 2; + return CreateItemMoniker(L"!", itemnameW, moniker); case 'A': - *eaten += 2; + *eaten = 2; *moniker = create_antimoniker(desc[1] - '0'); return S_OK; case 'C': - (*eaten)++; - hr = create_moniker_from_desc(desc, eaten, &left); + *eaten = 1; + desc++; + + comp_len = 0; + hr = create_moniker_parse_desc(desc, &comp_len, &left); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - hr = create_moniker_from_desc(desc, eaten, &right); + + *eaten += comp_len; + desc += comp_len; + + comp_len = 0; + hr = create_moniker_parse_desc(desc, &comp_len, &right); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + *eaten += comp_len; + hr = CreateGenericComposite(left, right, moniker); IMoniker_Release(left); IMoniker_Release(right); @@ -164,6 +172,12 @@ static HRESULT create_moniker_from_desc(const char *desc, unsigned int *eaten, } }
+static HRESULT create_moniker_from_desc(const char *desc, IMoniker **moniker) +{ + unsigned int eaten = 0; + return create_moniker_parse_desc(desc, &eaten, moniker); +} + static SIZE_T round_global_size(SIZE_T size) { static SIZE_T global_size_alignment = -1; @@ -2642,8 +2656,7 @@ todo_wine
/* Simplification has to through generic composite logic, even when resolved to non-composite, generic composite option has to be enabled. */ - eaten = 0; - hr = create_moniker_from_desc("CA1A3", &eaten, &c); + hr = create_moniker_from_desc("CA1A3", &c); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2); ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr); @@ -2972,7 +2985,6 @@ static void test_generic_composite_moniker(void) IMoniker *moniker, *inverse, *moniker1, *moniker2; IEnumMoniker *enummoniker; IRunningObjectTable *rot; - unsigned int eaten, i; DWORD hash, cookie; HRESULT hr; IBindCtx *bindctx; @@ -2981,6 +2993,7 @@ static void test_generic_composite_moniker(void) IROTData *rotdata; IMarshal *marshal; IStream *stream; + unsigned int i; FILETIME ft; WCHAR *str; ULONG len; @@ -2991,16 +3004,14 @@ static void test_generic_composite_moniker(void) for (i = 0; i < ARRAY_SIZE(simplify_tests); ++i) { IMoniker *left, *right, *composite = NULL; - unsigned int moniker_type, eaten; + unsigned int moniker_type; WCHAR *name;
winetest_push_context("simplify[%u]", i);
- eaten = 0; - hr = create_moniker_from_desc(simplify_tests[i].left, &eaten, &left); + hr = create_moniker_from_desc(simplify_tests[i].left, &left); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - eaten = 0; - hr = create_moniker_from_desc(simplify_tests[i].right, &eaten, &right); + hr = create_moniker_from_desc(simplify_tests[i].right, &right); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); hr = CreateGenericComposite(left, right, &composite); ok(hr == S_OK, "Failed to create a composite, hr %#x.\n", hr); @@ -3162,12 +3173,10 @@ todo_wine IMoniker_Release(moniker);
/* GetTimeOfLastChange() */ - eaten = 0; - hr = create_moniker_from_desc("CI1I2", &eaten, &moniker); + hr = create_moniker_from_desc("CI1I2", &moniker); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
- eaten = 0; - hr = create_moniker_from_desc("I1", &eaten, &moniker1); + hr = create_moniker_from_desc("I1", &moniker1); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
/* See if non-generic composition is possible */ @@ -3224,7 +3233,6 @@ static void test_pointer_moniker(void) IStream *stream; IROTData *rotdata; LPOLESTR display_name; - unsigned int eaten; IMarshal *marshal; LARGE_INTEGER pos; CLSID clsid; @@ -3417,8 +3425,7 @@ static void test_pointer_moniker(void) even when resolved to non-composite, generic composite option has to be enabled. */
/* P + (A,A3) -> A3 */ - eaten = 0; - hr = create_moniker_from_desc("CA1A3", &eaten, &c); + hr = create_moniker_from_desc("CA1A3", &c); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2); ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr); @@ -3432,8 +3439,7 @@ static void test_pointer_moniker(void) IMoniker_Release(c);
/* P + (A,I) -> I */ - eaten = 0; - hr = create_moniker_from_desc("CA1I1", &eaten, &c); + hr = create_moniker_from_desc("CA1I1", &c); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2); ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/tests/moniker.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 6b21a2e732e..ae46db110b6 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -1830,7 +1830,7 @@ static void test_class_moniker(void) { L"clsid:{11111111-0000-0000-2222-444444444444", 0, MK_E_SYNTAX }, { L"clsid:11111111-0000-0000-2222-444444444444}", 43 }, }; - IMoniker *moniker, *moniker2, *inverse, *reduced, *anti; + IMoniker *moniker, *moniker2, *inverse, *reduced, *anti, *c; IEnumMoniker *enummoniker; ULONG length, eaten; ULARGE_INTEGER size; @@ -2036,13 +2036,35 @@ todo_wine ok(!moniker2, "Unexpected pointer.\n"); IMoniker_Release(anti);
- /* C + A2 -> A */ + /* C + A2 -> () */ anti = create_antimoniker(2); hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2); ok(hr == S_OK, "Failed to compose, hr %#x.\n", hr); ok(!moniker2, "Unexpected pointer.\n"); IMoniker_Release(anti);
+ /* C + (A,I) -> I */ + hr = create_moniker_from_desc("CA1I1", &c); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2); + ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr); + hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + TEST_MONIKER_TYPE(moniker2, MKSYS_ITEMMONIKER); + IMoniker_Release(moniker2); + IMoniker_Release(c); + + /* C + (A2,I) -> I */ + hr = create_moniker_from_desc("CA1I1", &c); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2); + ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr); + hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + TEST_MONIKER_TYPE(moniker2, MKSYS_ITEMMONIKER); + IMoniker_Release(moniker2); + IMoniker_Release(c); + IMoniker_Release(moniker); }