Sync to Wine-0_9_5:
Jacek Caban <jacek@codeweavers.com>
- shlwapi: Fix UrlCanonicalize.
- Added support for URL_FILE_USE_PATHURL.
- Fix handling of '/' and '\'.
Marcus Meissner <marcus@jet.franken.de>
- shlwapi: Print PathCombine* strings arguments in relay debugging.
Modified: trunk/reactos/include/wine/shlwapi.h
Modified: trunk/reactos/lib/shlwapi/shlwapi.spec
Modified: trunk/reactos/lib/shlwapi/url.c

Modified: trunk/reactos/include/wine/shlwapi.h
--- trunk/reactos/include/wine/shlwapi.h	2006-01-06 20:30:08 UTC (rev 20625)
+++ trunk/reactos/include/wine/shlwapi.h	2006-01-06 20:35:12 UTC (rev 20626)
@@ -12,6 +12,8 @@
 #ifndef __WINE_SHLWAPI_H
 #define __WINE_SHLWAPI_H
 
+#define URL_FILE_USE_PATHURL 0x00010000
+
 #define INTERFACE IQueryAssociations
 DECLARE_INTERFACE_(IQueryAssociations,IUnknown)
 {

Modified: trunk/reactos/lib/shlwapi/shlwapi.spec
--- trunk/reactos/lib/shlwapi/shlwapi.spec	2006-01-06 20:30:08 UTC (rev 20625)
+++ trunk/reactos/lib/shlwapi/shlwapi.spec	2006-01-06 20:35:12 UTC (rev 20626)
@@ -574,8 +574,8 @@
 @ stdcall PathBuildRootW (ptr long)
 @ stdcall PathCanonicalizeA (ptr str)
 @ stdcall PathCanonicalizeW (ptr wstr)
-@ stdcall PathCombineA (ptr ptr ptr)
-@ stdcall PathCombineW (ptr ptr ptr)
+@ stdcall PathCombineA (ptr str str)
+@ stdcall PathCombineW (ptr wstr wstr)
 @ stdcall PathCommonPrefixA(str str ptr)
 @ stdcall PathCommonPrefixW(wstr wstr ptr)
 @ stdcall PathCompactPathA(long str long)

Modified: trunk/reactos/lib/shlwapi/url.c
--- trunk/reactos/lib/shlwapi/url.c	2006-01-06 20:30:08 UTC (rev 20625)
+++ trunk/reactos/lib/shlwapi/url.c	2006-01-06 20:35:12 UTC (rev 20626)
@@ -328,9 +328,10 @@
 {
     HRESULT hr = S_OK;
     DWORD EscapeFlags;
-    LPWSTR lpszUrlCpy, wk1, wk2, mp, root;
+    LPWSTR lpszUrlCpy, wk1, wk2, mp, mp2, root;
     INT nByteLen, state;
     DWORD nLen, nWkLen;
+    WCHAR slash = dwFlags & URL_FILE_USE_PATHURL ? '\\' : '/';
 
     TRACE("(%s %p %p 0x%08lx)\n", debugstr_w(pszUrl), pszCanonicalized,
 	  pcchCanonicalized, dwFlags);
@@ -377,31 +378,49 @@
 		*wk2++ = *wk1++;
 		if (*wk1 != L'/') {state = 6; break;}
 		*wk2++ = *wk1++;
+                if((dwFlags & URL_FILE_USE_PATHURL) && *wk1 == '/')
+                    wk1++;
 		state = 4;
 		break;
 	    case 3:
 		nWkLen = strlenW(wk1);
 		memcpy(wk2, wk1, (nWkLen + 1) * sizeof(WCHAR));
+                mp = wk2;
 		wk1 += nWkLen;
 		wk2 += nWkLen;
+
+                while(mp < wk2) {
+                    if(*mp == '/' || *mp == '\\')
+                        *mp = slash;
+                    mp++;
+                }
 		break;
 	    case 4:
-		if (!isalnumW(*wk1) && (*wk1 != L'-') && (*wk1 != L'.')) {state = 3; break;}
-		while(isalnumW(*wk1) || (*wk1 == L'-') || (*wk1 == L'.')) *wk2++ = *wk1++;
-		state = 5;
+                if (!isalnumW(*wk1) && (*wk1 != L'-') && (*wk1 != L'.') && (*wk1 != ':'))
+                    {state = 3; break;}
+                while(isalnumW(*wk1) || (*wk1 == L'-') || (*wk1 == L'.') || (*wk1 == ':'))
+                    *wk2++ = *wk1++;
+                state = 5;
+                break;
+            case 5:
+                if (*wk1 != '/' && *wk1 != '\\') {state = 3; break;}
+                while(*wk1 == '/') {
+                    *wk2++ = slash;
+                    wk1++;
+                }
+                state = 6;
 		break;
-	    case 5:
-		if (*wk1 != L'/') {state = 3; break;}
-		*wk2++ = *wk1++;
-		state = 6;
-		break;
 	    case 6:
 		/* Now at root location, cannot back up any more. */
 		/* "root" will point at the '/' */
 		root = wk2-1;
 		while (*wk1) {
 		    TRACE("wk1=%c\n", (CHAR)*wk1);
-		    mp = strchrW(wk1, L'/');
+
+                    mp = strchrW(wk1, '/');
+                    mp2 = strchrW(wk1, '\\');
+                    if(mp2 && mp2 < mp)
+                        mp = mp2;
 		    if (!mp) {
 			nWkLen = strlenW(wk1);
 			memcpy(wk2, wk1, (nWkLen + 1) * sizeof(WCHAR));
@@ -409,35 +428,41 @@
 			wk2 += nWkLen;
 			continue;
 		    }
-		    nLen = mp - wk1 + 1;
-		    memcpy(wk2, wk1, nLen * sizeof(WCHAR));
-		    wk2 += nLen;
-		    wk1 += nLen;
+                    nLen = mp - wk1;
+                    if(nLen) {
+                        memcpy(wk2, wk1, nLen * sizeof(WCHAR));
+                        wk2 += nLen;
+                        wk1 += nLen;
+                    }
+                    *wk2++ = slash;
+                    wk1++;
+
 		    if (*wk1 == L'.') {
 			TRACE("found '/.'\n");
-			if (*(wk1+1) == L'/') {
+                        if (wk1[1] == '/' || wk1[1] == '\\') {
 			    /* case of /./ -> skip the ./ */
 			    wk1 += 2;
 			}
-			else if (*(wk1+1) == L'.') {
+                        else if (wk1[1] == '.') {
 			    /* found /..  look for next / */
 			    TRACE("found '/..'\n");
-			    if (*(wk1+2) == L'/' || *(wk1+2) == L'?' || *(wk1+2) == L'#' || *(wk1+2) == 0) {
+                            if (wk1[2] == '/' || wk1[2] == '\\' ||wk1[2] == '?'
+                                    || wk1[2] == '#' || !wk1[2]) {
 				/* case /../ -> need to backup wk2 */
 				TRACE("found '/../'\n");
 				*(wk2-1) = L'\0';  /* set end of string */
-				mp = strrchrW(root, L'/');
+                                mp = strrchrW(root, slash);
 				if (mp && (mp >= root)) {
 				    /* found valid backup point */
 				    wk2 = mp + 1;
-				    if(*(wk1+2) != L'/')
+                                    if(wk1[2] != '/' && wk1[2] != '\\')
 				        wk1 += 2;
 				    else
 				        wk1 += 3;
 				}
 				else {
-				    /* did not find point, restore '/' */
-				    *(wk2-1) = L'/';
+                                    /* did not find point, restore '/' */
+                                    *(wk2-1) = slash;
 				}
 			    }
 			}
@@ -459,7 +484,7 @@
     while ((nLen > 0) && ((lpszUrlCpy[nLen-1] == '\r')||(lpszUrlCpy[nLen-1] == '\n')))
         lpszUrlCpy[--nLen]=0;
 
-    if(dwFlags & URL_UNESCAPE)
+    if(dwFlags & (URL_UNESCAPE | URL_FILE_USE_PATHURL))
         UrlUnescapeW(lpszUrlCpy, NULL, &nLen, URL_UNESCAPE_INPLACE);
 
     if((EscapeFlags = dwFlags & (URL_ESCAPE_UNSAFE |