Commit 3ceaaae3 authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

shlwapi: Fix UrlCanonicalizeW's handling of filesystem paths.

parent b504d050
...@@ -68,6 +68,7 @@ const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = { ...@@ -68,6 +68,7 @@ const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = {
{"http://www.winehq.org/tests/foo%20bar", URL_UNESCAPE , S_OK, "http://www.winehq.org/tests/foo bar"}, {"http://www.winehq.org/tests/foo%20bar", URL_UNESCAPE , S_OK, "http://www.winehq.org/tests/foo bar"},
{"file:///c:/tests/foo%20bar", URL_UNESCAPE , S_OK, "file:///c:/tests/foo bar"}, {"file:///c:/tests/foo%20bar", URL_UNESCAPE , S_OK, "file:///c:/tests/foo bar"},
{"file:///c:/tests\\foo%20bar", URL_UNESCAPE , S_OK, "file:///c:/tests/foo bar"}, {"file:///c:/tests\\foo%20bar", URL_UNESCAPE , S_OK, "file:///c:/tests/foo bar"},
{"file:///c:/tests/foo%20bar", 0, S_OK, "file:///c:/tests/foo%20bar"},
{"file:///c:/tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar"}, {"file:///c:/tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar"},
{"file://c:/tests/../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar"}, {"file://c:/tests/../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar"},
{"file://c:/tests\\../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar"}, {"file://c:/tests\\../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar"},
...@@ -80,6 +81,8 @@ const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = { ...@@ -80,6 +81,8 @@ const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = {
{"c:\\dir\\file", 0, S_OK, "file:///c:/dir/file"}, {"c:\\dir\\file", 0, S_OK, "file:///c:/dir/file"},
{"file:///c:\\dir\\file", 0, S_OK, "file:///c:/dir/file"}, {"file:///c:\\dir\\file", 0, S_OK, "file:///c:/dir/file"},
{"c:dir\\file", 0, S_OK, "file:///c:dir/file"}, {"c:dir\\file", 0, S_OK, "file:///c:dir/file"},
{"c:\\tests\\foo bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar"},
{"c:\\tests\\foo bar", 0, S_OK, "file:///c:/tests/foo%20bar"},
{"A", 0, S_OK, "A"}, {"A", 0, S_OK, "A"},
{"", 0, S_OK, ""} {"", 0, S_OK, ""}
}; };
...@@ -509,12 +512,6 @@ static void test_UrlCanonicalize(void) ...@@ -509,12 +512,6 @@ static void test_UrlCanonicalize(void)
/* move to TEST_CANONICALIZE when fixed */ /* move to TEST_CANONICALIZE when fixed */
dwSize = sizeof szReturnUrl; dwSize = sizeof szReturnUrl;
ok(UrlCanonicalizeA("c:\\tests\\foo bar", szReturnUrl, &dwSize, 0) == S_OK, "UrlCanonicalizeA didn't return 0x%08x\n", S_OK);
todo_wine {
ok(strcmp(szReturnUrl,"file:///c:/tests/foo%20bar")==0, "UrlCanonicalizeA got %s\n", szReturnUrl);
}
dwSize = sizeof szReturnUrl;
/*LimeWire online installer calls this*/ /*LimeWire online installer calls this*/
hr = UrlCanonicalizeA("/uri-res/N2R?urn:sha1:B3K", szReturnUrl, &dwSize,URL_DONT_ESCAPE_EXTRA_INFO | URL_WININET_COMPATIBILITY /*0x82000000*/); hr = UrlCanonicalizeA("/uri-res/N2R?urn:sha1:B3K", szReturnUrl, &dwSize,URL_DONT_ESCAPE_EXTRA_INFO | URL_WININET_COMPATIBILITY /*0x82000000*/);
ok(hr==S_OK,"UrlCanonicalizeA returned 0x%08x instead of S_OK\n", hr); ok(hr==S_OK,"UrlCanonicalizeA returned 0x%08x instead of S_OK\n", hr);
......
...@@ -358,6 +358,13 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized, ...@@ -358,6 +358,13 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
memcpy(wk2, wszFilePrefix, sizeof(wszFilePrefix)); memcpy(wk2, wszFilePrefix, sizeof(wszFilePrefix));
wk2 += sizeof(wszFilePrefix)/sizeof(WCHAR); wk2 += sizeof(wszFilePrefix)/sizeof(WCHAR);
if (dwFlags & URL_FILE_USE_PATHURL)
{
slash = '\\';
--wk2;
}
else
dwFlags |= URL_ESCAPE_UNSAFE;
state = 5; state = 5;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment