Nikolay Sivov : ole32/composite: Do not use antimoniker composition in BindToStorage().

Alexandre Julliard julliard at winehq.org
Wed Sep 29 15:54:09 CDT 2021


Module: wine
Branch: master
Commit: 5855196be9ce97c9850d395d78ddd5c79165b200
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5855196be9ce97c9850d395d78ddd5c79165b200

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Sep 29 10:23:26 2021 +0300

ole32/composite: Do not use antimoniker composition in BindToStorage().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;
 }
 
 /******************************************************************************




More information about the wine-cvs mailing list