[PATCH 1/6] hlink: Fix HlinkCreateFromString to create a URL moniker if the input target is a URL.

Robert Shearman rob at codeweavers.com
Wed May 23 13:04:13 CDT 2007


---
  dlls/hlink/hlink_main.c |   19 ++++++++++++-------
  1 files changed, 12 insertions(+), 7 deletions(-)
-------------- next part --------------
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( LP
 
         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-patches mailing list