PathCreateFromUrlW
Matthew Mastracci
matt at aclaro.com
Tue Dec 31 12:46:14 CST 2002
Here's an implementation of PathCreateFromUrlW that helps Kazaa crash
later rather than sooner. :)
Can someone review this and check it in (if it doesn't require any
fixes)?
Index: path.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/path.c,v
retrieving revision 1.27
diff -r1.27 path.c
3157c3157,3159
< FIXME("(%s,%p,%p,0x%08lx)-stub\n", debugstr_w(lpszUrl), lpszPath,
pcchPath, dwFlags);
---
> static const WCHAR stemp[] = { 'f','i','l','e',':','/','/',0 };
> LPWSTR pwszPathPart;
> TRACE("(%s,%p,%p,0x%08lx)\n", debugstr_w(lpszUrl), lpszPath,
pcchPath, dwFlags);
3162c3164,3189
< return S_OK;
---
> // Path of the form file://...
> if (!strncmpW(lpszUrl, stemp, 7))
> {
> lpszUrl += 7;
> }
> // Path of the form file:...
> else if (!strncmpW(lpszUrl, stemp, 5))
> {
> lpszUrl += 5;
> }
>
> // Ensure that path is of the form c:... or c|...
> if (lpszUrl[1] != ':' && lpszUrl[1] != '|' && isalphaW(*lpszUrl))
> return E_INVALIDARG;
>
> HRESULT hr = UrlUnescapeW(lpszUrl, lpszPath, pcchPath, dwFlags);
> if (lpszPath[1] == '|')
> lpszPath[1] = ':';
>
> for (pwszPathPart = lpszPath; *pwszPathPart; pwszPathPart++)
> if (*pwszPathPart == '/')
> *pwszPathPart = '\\';
>
> TRACE("Returning %s\n",debugstr_w(lpszPath));
>
> return hr;
--
Matthew Mastracci <matt at aclaro.com>
More information about the wine-devel
mailing list