Added shlwapi-UrlCanonicalize patchset

This commit is contained in:
Alistair Leslie-Hughes 2019-07-01 08:17:41 +10:00
parent fbb8eac819
commit 292e3c87d9
4 changed files with 104 additions and 15 deletions

View File

@ -274,6 +274,7 @@ patch_enable_all ()
enable_shell32_UnixFS="$1"
enable_shlwapi_AssocGetPerceivedType="$1"
enable_shlwapi_SHAddDataBlock="$1"
enable_shlwapi_UrlCanonicalize="$1"
enable_shlwapi_UrlCombine="$1"
enable_stdole32_idl_Typelib="$1"
enable_stdole32_tlb_SLTG_Typelib="$1"
@ -945,6 +946,9 @@ patch_enable ()
shlwapi-SHAddDataBlock)
enable_shlwapi_SHAddDataBlock="$2"
;;
shlwapi-UrlCanonicalize)
enable_shlwapi_UrlCanonicalize="$2"
;;
shlwapi-UrlCombine)
enable_shlwapi_UrlCombine="$2"
;;
@ -5761,6 +5765,21 @@ if test "$enable_shlwapi_SHAddDataBlock" -eq 1; then
) >> "$patchlist"
fi
# Patchset shlwapi-UrlCanonicalize
# |
# | This patchset fixes the following Wine bugs:
# | * [#23166] shlwapi: Support ./ in UrlCanonicalize.
# |
# | Modified files:
# | * dlls/kernelbase/path.c, dlls/shlwapi/tests/url.c
# |
if test "$enable_shlwapi_UrlCanonicalize" -eq 1; then
patch_apply shlwapi-UrlCanonicalize/0001-shlwapi-Support-.-in-UrlCanonicalize.patch
(
printf '%s\n' '+ { "Alistair Leslie-Hughes", "shlwapi: Support ./ in UrlCanonicalize.", 1 },';
) >> "$patchlist"
fi
# Patchset shlwapi-UrlCombine
# |
# | Modified files:

View File

@ -0,0 +1,70 @@
From d1a351c80c4c8c7133d76ace60271736d5220c01 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 28 Jun 2019 09:57:31 +1000
Subject: [PATCH] shlwapi: Support ./ in UrlCanonicalize.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=23166
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/kernelbase/path.c | 15 +++++++++++++++
dlls/shlwapi/tests/url.c | 4 ++++
2 files changed, 19 insertions(+)
diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index 82708be544..83922c0278 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -3593,6 +3593,7 @@ HRESULT WINAPI UrlCanonicalizeW(const WCHAR *src_url, WCHAR *canonicalized, DWOR
* 4 have // 5,3
* 5 have 1[+] alnum 6,3
* 6 have location (found /) save root location
+ * 7 have ./
*/
wk1 = url;
@@ -3619,6 +3620,11 @@ HRESULT WINAPI UrlCanonicalizeW(const WCHAR *src_url, WCHAR *canonicalized, DWOR
state = 5;
is_file_url = TRUE;
}
+ else if (url[0] == '.' && url[1] == '/')
+ {
+ state = 7;
+ is_file_url = TRUE;
+ }
while (*wk1)
{
@@ -3823,6 +3829,15 @@ HRESULT WINAPI UrlCanonicalizeW(const WCHAR *src_url, WCHAR *canonicalized, DWOR
}
*wk2 = '\0';
break;
+ case 7:
+ if (flags & URL_DONT_SIMPLIFY)
+ {
+ state = 3;
+ break;
+ }
+ wk1 += 2;
+ state = 6;
+ break;
default:
FIXME("how did we get here - state=%d\n", state);
heap_free(url_copy);
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index d30737f60a..96635c9836 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -204,6 +204,10 @@ static const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = {
{"///A/../B", URL_WININET_COMPATIBILITY, S_OK, "///B", FALSE},
{"A", 0, S_OK, "A", FALSE},
{"../A", 0, S_OK, "../A", FALSE},
+ {"./A", 0, S_OK, "A", FALSE},
+ {"./A/./B", 0, S_OK, "A/B", FALSE},
+ {"./A", URL_DONT_SIMPLIFY, S_OK, "./A", FALSE},
+ {"A/./B", 0, S_OK, "A/B", TRUE},
{"A/../B", 0, S_OK, "B", TRUE},
{"/uri-res/N2R?urn:sha1:B3K", URL_DONT_ESCAPE_EXTRA_INFO | URL_WININET_COMPATIBILITY /*0x82000000*/, S_OK, "/uri-res/N2R?urn:sha1:B3K", FALSE} /*LimeWire online installer calls this*/,
{"http:www.winehq.org/dir/../index.html", 0, S_OK, "http:www.winehq.org/index.html"},
--
2.17.1

View File

@ -0,0 +1 @@
Fixes: [23166] shlwapi: Support ./ in UrlCanonicalize.

View File

@ -1,26 +1,25 @@
From d753083297595b1ed4d3533587ddc21dee47fd88 Mon Sep 17 00:00:00 2001
From 95dcb9cf88979d5894c300a71a080470dcefde87 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 17 Jan 2014 01:19:41 +0100
Subject: [PATCH] shlwapi/tests: Add additional tests for UrlCombine and
UrlCanonicalize
---
dlls/shlwapi/tests/url.c | 46 ++++++++++++++++++++++++++++++++++++----------
dlls/shlwapi/tests/url.c | 46 +++++++++++++++++++++++++++++++---------
1 file changed, 36 insertions(+), 10 deletions(-)
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index d30737f..37df286 100644
index 96635c98361..90e0d2e1b10 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -204,7 +204,15 @@ static const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = {
{"///A/../B", URL_WININET_COMPATIBILITY, S_OK, "///B", FALSE},
{"A", 0, S_OK, "A", FALSE},
{"../A", 0, S_OK, "../A", FALSE},
+ {".\\A", 0, S_OK, ".\\A", FALSE},
+ {"A\\.\\B", 0, S_OK, "A\\.\\B", FALSE},
@@ -209,6 +209,14 @@ static const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = {
{"./A", URL_DONT_SIMPLIFY, S_OK, "./A", FALSE},
{"A/./B", 0, S_OK, "A/B", TRUE},
{"A/../B", 0, S_OK, "B", TRUE},
+ {"A/../B/./../C", 0, S_OK, "C", TRUE},
+ {"A/../B/./../C", URL_DONT_SIMPLIFY, S_OK, "A/../B/./../C", FALSE},
+ {".\\A", 0, S_OK, ".\\A", FALSE},
+ {"A\\.\\B", 0, S_OK, "A\\.\\B", FALSE},
+ {".", 0, S_OK, "/", TRUE},
+ {"./A", 0, S_OK, "A", TRUE},
+ {"A/./B", 0, S_OK, "A/B", TRUE},
@ -28,7 +27,7 @@ index d30737f..37df286 100644
{"/uri-res/N2R?urn:sha1:B3K", URL_DONT_ESCAPE_EXTRA_INFO | URL_WININET_COMPATIBILITY /*0x82000000*/, S_OK, "/uri-res/N2R?urn:sha1:B3K", FALSE} /*LimeWire online installer calls this*/,
{"http:www.winehq.org/dir/../index.html", 0, S_OK, "http:www.winehq.org/index.html"},
{"http://localhost/test.html", URL_FILE_USE_PATHURL, S_OK, "http://localhost/test.html"},
@@ -358,6 +366,7 @@ typedef struct _TEST_URL_COMBINE {
@@ -362,6 +370,7 @@ typedef struct _TEST_URL_COMBINE {
DWORD flags;
HRESULT expectret;
const char *expecturl;
@ -36,7 +35,7 @@ index d30737f..37df286 100644
} TEST_URL_COMBINE;
static const TEST_URL_COMBINE TEST_COMBINE[] = {
@@ -379,6 +388,15 @@ static const TEST_URL_COMBINE TEST_COMBINE[] = {
@@ -383,6 +392,15 @@ static const TEST_URL_COMBINE TEST_COMBINE[] = {
{"http://www.winehq.org/test14#aaa/bbb#ccc", "#", 0, S_OK, "http://www.winehq.org/test14#"},
{"http://www.winehq.org/tests/?query=x/y/z", "tests15", 0, S_OK, "http://www.winehq.org/tests/tests15"},
{"http://www.winehq.org/tests/?query=x/y/z#example", "tests16", 0, S_OK, "http://www.winehq.org/tests/tests16"},
@ -52,7 +51,7 @@ index d30737f..37df286 100644
{"file:///C:\\dir\\file.txt", "test.txt", 0, S_OK, "file:///C:/dir/test.txt"},
{"file:///C:\\dir\\file.txt#hash\\hash", "test.txt", 0, S_OK, "file:///C:/dir/file.txt#hash/test.txt"},
{"file:///C:\\dir\\file.html#hash\\hash", "test.html", 0, S_OK, "file:///C:/dir/test.html"},
@@ -1197,7 +1215,7 @@ static void test_UrlCanonicalizeW(void)
@@ -1201,7 +1219,7 @@ static void test_UrlCanonicalizeW(void)
/* ########################### */
@ -61,7 +60,7 @@ index d30737f..37df286 100644
{
HRESULT hr;
CHAR szReturnUrl[INTERNET_MAX_URL_LENGTH];
@@ -1222,34 +1240,42 @@ static void test_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFla
@@ -1226,34 +1244,42 @@ static void test_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFla
dwSize = 0;
hr = pUrlCombineA(szUrl1, szUrl2, NULL, &dwSize, dwFlags);
ok(hr == E_POINTER, "Checking length of string, return was 0x%08x, expected 0x%08x\n", hr, E_POINTER);
@ -112,7 +111,7 @@ index d30737f..37df286 100644
if(SUCCEEDED(hr)) {
wszConvertedUrl = GetWideString(szReturnUrl);
ok(lstrcmpW(wszReturnUrl, wszConvertedUrl)==0, "Strings didn't match between ascii and unicode UrlCombine!\n");
@@ -1269,7 +1295,7 @@ static void test_UrlCombine(void)
@@ -1273,7 +1299,7 @@ static void test_UrlCombine(void)
unsigned int i;
for (i = 0; i < ARRAY_SIZE(TEST_COMBINE); i++) {
test_url_combine(TEST_COMBINE[i].url1, TEST_COMBINE[i].url2, TEST_COMBINE[i].flags,
@ -122,5 +121,5 @@ index d30737f..37df286 100644
}
--
1.9.1
2.17.1