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

This commit is contained in:
Rob Shearman 2007-05-23 19:04:13 +01:00 committed by Alexandre Julliard
parent 58634e8481
commit 873905ac43
1 changed files with 12 additions and 7 deletions

View File

@ -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);
}