Rob Shearman : hlink: Fix HlinkCreateFromString to create a URL moniker if the input target is a URL .

Alexandre Julliard julliard at wine.codeweavers.com
Fri May 25 14:43:23 CDT 2007


Module: wine
Branch: master
Commit: 873905ac43151a6b1c5df93e4a0bea791549bf65
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=873905ac43151a6b1c5df93e4a0bea791549bf65

Author: Rob Shearman <rob at codeweavers.com>
Date:   Wed May 23 19:04:13 2007 +0100

hlink: Fix HlinkCreateFromString to create a URL moniker if the input target is a URL.

---

 dlls/hlink/hlink_main.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/dlls/hlink/hlink_main.c b/dlls/hlink/hlink_main.c
index 1a595ae..3a4632f 100644
--- a/dlls/hlink/hlink_main.c
+++ b/dlls/hlink/hlink_main.c
@@ -134,17 +134,22 @@ HRESULT WINAPI HlinkCreateFromString( LPCWSTR pwzTarget, LPCWSTR pwzLocation,
 
         if (FAILED(r))
         {
-            FIXME("ParseDisplayName failed, falling back to file\n");
-            r = CreateFileMoniker(pwzTarget,&pTgtMk);
+            LPCWSTR p = strchrW(pwzTarget, ':');
+            if (p && (p - pwzTarget > 1))
+                r = CreateURLMoniker(NULL, pwzTarget, &pTgtMk);
+            else
+                r = CreateFileMoniker(pwzTarget,&pTgtMk);
         }
 
-        if (pTgtMk)
+        if (FAILED(r))
         {
-            IHlink_SetMonikerReference(hl, 0, pTgtMk, pwzLocation);
-            IMoniker_Release(pTgtMk);
+            ERR("couldn't create moniker for %s, failed with error 0x%08x\n",
+                debugstr_w(pwzTarget), r);
+            return r;
         }
-        else
-            FIXME("Unable to come up with a moniker, expect problems\n");
+
+        IHlink_SetMonikerReference(hl, 0, pTgtMk, pwzLocation);
+        IMoniker_Release(pTgtMk);
 
         IHlink_SetStringReference(hl, HLINKSETF_TARGET, pwzTarget, NULL);
     }




More information about the wine-cvs mailing list