[HLINK] Sync with Wine 3.0. CORE-14225
authorAmine Khaldi <amine.khaldi@reactos.org>
Thu, 18 Jan 2018 23:23:23 +0000 (00:23 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Thu, 18 Jan 2018 23:23:23 +0000 (00:23 +0100)
dll/win32/hlink/browse_ctx.c
dll/win32/hlink/link.c
media/doc/README.WINE

index 0e76284..00007f6 100644 (file)
@@ -95,10 +95,11 @@ static ULONG WINAPI IHlinkBC_fnRelease (IHlinkBrowseContext* iface)
     return ref;
 }
 
+static const WCHAR szIdent[] = {'W','I','N','E','H','L','I','N','K',0};
+
 static HRESULT WINAPI IHlinkBC_Register(IHlinkBrowseContext* iface,
         DWORD dwReserved, IUnknown *piunk, IMoniker *pimk, DWORD *pdwRegister)
 {
-    static const WCHAR szIdent[] = {'W','I','N','E','H','L','I','N','K',0};
     HlinkBCImpl  *This = impl_from_IHlinkBrowseContext(iface);
     IMoniker *mon;
     IMoniker *composite;
@@ -122,11 +123,29 @@ static HRESULT WINAPI IHlinkBC_Register(IHlinkBrowseContext* iface,
     return S_OK;
 }
 
-static HRESULT WINAPI IHlinkBC_GetObject(IHlinkBrowseContext* face,
+static HRESULT WINAPI IHlinkBC_GetObject(IHlinkBrowseContext* iface,
         IMoniker *pimk, BOOL fBindifRootRegistered, IUnknown **ppiunk)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
+    IMoniker *mon;
+    IMoniker *composite;
+    IRunningObjectTable *ROT;
+    HRESULT hr;
+
+    TRACE("(%p)->(%p, %d, %p)\n", This, pimk, fBindifRootRegistered, ppiunk);
+
+    hr = CreateItemMoniker(NULL, szIdent, &mon);
+    if (FAILED(hr)) return hr;
+    CreateGenericComposite(mon, pimk, &composite);
+
+    GetRunningObjectTable(0, &ROT);
+    hr = IRunningObjectTable_GetObject(ROT, composite, ppiunk);
+
+    IRunningObjectTable_Release(ROT);
+    IMoniker_Release(composite);
+    IMoniker_Release(mon);
+
+    return hr;
 }
 
 static HRESULT WINAPI IHlinkBC_Revoke(IHlinkBrowseContext* iface,
index c240fcc..88b7093 100644 (file)
@@ -481,25 +481,33 @@ static HRESULT WINAPI IHlink_fnNavigate(IHlink* iface, DWORD grfHLNF, LPBC pbc,
 
     if (SUCCEEDED(r))
     {
-        IBindCtx *bcxt;
+        IBindCtx *bcxt = NULL;
         IUnknown *unk = NULL;
         IHlinkTarget *target;
 
-        CreateBindCtx(0, &bcxt);
-
-        RegisterBindStatusCallback(bcxt, pbsc, NULL, 0);
-
-        r = IMoniker_BindToObject(mon, bcxt, NULL, &IID_IUnknown, (void**)&unk);
-        if (r == S_OK)
-        {
-            r = IUnknown_QueryInterface(unk, &IID_IHlinkTarget, (void**)&target);
-            IUnknown_Release(unk);
-        }
-        if (r == S_OK)
+        if (phbc)
         {
-            IHlinkTarget_SetBrowseContext(target, phbc);
-            r = IHlinkTarget_Navigate(target, grfHLNF, This->Location);
-            IHlinkTarget_Release(target);
+            r = IHlinkBrowseContext_GetObject(phbc, mon, TRUE, &unk);
+            if (r == S_FALSE)
+            {
+                CreateBindCtx(0, &bcxt);
+                RegisterBindStatusCallback(bcxt, pbsc, NULL, 0);
+                r = IMoniker_BindToObject(mon, bcxt, NULL, &IID_IUnknown, (void**)&unk);
+            }
+            if (r == S_OK)
+            {
+                r = IUnknown_QueryInterface(unk, &IID_IHlinkTarget, (void **)&target);
+                IUnknown_Release(unk);
+            }
+            if (r == S_OK)
+            {
+                if (bcxt) IHlinkTarget_SetBrowseContext(target, phbc);
+                r = IHlinkTarget_Navigate(target, grfHLNF, This->Location);
+                IHlinkTarget_Release(target);
+            }
+
+            RevokeBindStatusCallback(bcxt, pbsc);
+            if (bcxt) IBindCtx_Release(bcxt);
         }
         else
         {
@@ -511,12 +519,9 @@ static HRESULT WINAPI IHlink_fnNavigate(IHlink* iface, DWORD grfHLNF, LPBC pbc,
             {
                 ShellExecuteW(NULL, szOpen, target, NULL, NULL, SW_SHOW);
                 CoTaskMemFree(target);
+                r = DRAGDROP_S_DROP;
             }
         }
-
-        RevokeBindStatusCallback(bcxt, pbsc);
-
-        IBindCtx_Release(bcxt);
         IMoniker_Release(mon);
     }
 
index d6031a5..e67bc01 100644 (file)
@@ -70,7 +70,7 @@ reactos/dll/win32/fontsub             # Synced to WineStaging-2.9
 reactos/dll/win32/fusion              # Synced to Wine-3.0
 reactos/dll/win32/gdiplus             # Synced to Wine-3.0
 reactos/dll/win32/hhctrl.ocx          # Synced to Wine-3.0
-reactos/dll/win32/hlink               # Synced to WineStaging-2.9
+reactos/dll/win32/hlink               # Synced to Wine-3.0
 reactos/dll/win32/hnetcfg             # Synced to WineStaging-2.9
 reactos/dll/win32/httpapi             # Synced to WineStaging-2.9
 reactos/dll/win32/iccvid              # Synced to WineStaging-2.9