PathCreateFromUrlW

Matthew Mastracci matt at aclaro.com
Tue Dec 31 13:21:02 CST 2002


Ok - this time for sure.  Thanks for the diff tips.

Index: dlls/shlwapi/path.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/path.c,v
retrieving revision 1.27
diff -u -r1.27 path.c
--- dlls/shlwapi/path.c	19 Dec 2002 04:16:54 -0000	1.27
+++ dlls/shlwapi/path.c	31 Dec 2002 19:17:47 -0000
@@ -3154,12 +3154,39 @@
 HRESULT WINAPI PathCreateFromUrlW(LPCWSTR lpszUrl, LPWSTR lpszPath,
                                   LPDWORD pcchPath, DWORD dwFlags)
 {
-  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);
 
   if (!lpszUrl || !lpszPath || !pcchPath || !*pcchPath)
     return E_INVALIDARG;
 
-  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;    
 }
 

/*************************************************************************


On Tue, 2002-12-31 at 11:01, Dimitrie O. Paun wrote:
> On December 31, 2002 02:06 pm, Matthew Mastracci wrote:
> > Sorry, here's the unified diff.
> 
> Thanks! However, please generate the diff relative to wine's
> root, as I suggested:
> 
> cvs diff -u dlls/shlwapi/path.c
> 
> What you did is this:
> 
> cd dlls/shlwapi; cvs diff -u path.c
> 
> which just makes things harder for Alexandre when applying
> the patch.
-- 
Matthew Mastracci <matt at aclaro.com>




More information about the wine-devel mailing list