shlwapi: Change '/'->'\' only for file protocol in UrlCanonicalize.

This commit is contained in:
Jacek Caban 2006-07-26 20:55:56 +02:00 committed by Alexandre Julliard
parent ae154d44e9
commit fddd703b38
2 changed files with 9 additions and 1 deletions

View File

@ -75,6 +75,8 @@ const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = {
{"file:///c://tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\\\tests\\foo bar"},
{"file:///c:\\tests\\foo bar", 0, S_OK, "file:///c:/tests/foo bar"},
{"file:///c:\\tests\\foo bar", URL_DONT_SIMPLIFY, S_OK, "file:///c:/tests/foo bar"},
{"http://www.winehq.org/site/about", URL_FILE_USE_PATHURL, S_OK, "http://www.winehq.org/site/about"},
{"file_://www.winehq.org/site/about", URL_FILE_USE_PATHURL, S_OK, "file_://www.winehq.org/site/about"},
};
typedef struct _TEST_URL_ESCAPE {

View File

@ -330,7 +330,9 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
LPWSTR lpszUrlCpy, wk1, wk2, mp, mp2, root;
INT nByteLen, state;
DWORD nLen, nWkLen;
WCHAR slash = dwFlags & URL_FILE_USE_PATHURL ? '\\' : '/';
WCHAR slash = '/';
static const WCHAR wszFile[] = {'f','i','l','e',':'};
TRACE("(%s %p %p 0x%08lx)\n", debugstr_w(pszUrl), pszCanonicalized,
pcchCanonicalized, dwFlags);
@ -341,6 +343,10 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
nByteLen = (lstrlenW(pszUrl) + 1) * sizeof(WCHAR); /* length in bytes */
lpszUrlCpy = HeapAlloc(GetProcessHeap(), 0, nByteLen);
if((dwFlags & URL_FILE_USE_PATHURL) && nByteLen >= sizeof(wszFile)
&& !memcmp(wszFile, pszUrl, sizeof(wszFile)))
slash = '\\';
/*
* state =
* 0 initial 1,3