Zebediah Figura : kernelbase: Allow the two initial slashes to be backslashes in UrlGetPart().

Alexandre Julliard julliard at winehq.org
Thu Feb 17 15:33:57 CST 2022


Module: wine
Branch: master
Commit: b72f7afc8bd603179b1eb66ae67423e4fee8f6d5
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b72f7afc8bd603179b1eb66ae67423e4fee8f6d5

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Wed Feb 16 20:31:40 2022 -0600

kernelbase: Allow the two initial slashes to be backslashes in UrlGetPart().

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernelbase/path.c   | 8 +++++++-
 dlls/shlwapi/tests/url.c | 8 ++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index e29ee585123..befdf237c5e 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -4191,6 +4191,11 @@ static const WCHAR *parse_url_element( const WCHAR *url, const WCHAR *separators
     return url + wcslen( url );
 }
 
+static BOOL is_slash( char c )
+{
+    return c == '/' || c == '\\';
+}
+
 static void parse_url( const WCHAR *url, struct parsed_url *pl )
 {
     const WCHAR *work;
@@ -4200,7 +4205,8 @@ static void parse_url( const WCHAR *url, struct parsed_url *pl )
     work = scan_url(pl->scheme, &pl->scheme_len, SCHEME);
     if (!*work || (*work != ':')) return;
     work++;
-    if ((*work != '/') || (*(work+1) != '/')) return;
+    if (!is_slash( work[0] ) || !is_slash( work[1] ))
+        return;
 
     pl->username = work + 2;
     work = parse_url_element( pl->username, L":@/\\?#" );
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index 18af0906e08..ae0d0738195 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -661,12 +661,12 @@ static void test_UrlGetPart(void)
         {"http:/localhost/index.html", URL_PART_HOSTNAME, 0, E_FAIL, .todo_hr = TRUE},
 
         {"http://localhost\\index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
-        {"http:/\\localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost", .todo_hr = TRUE},
-        {"http:\\/localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost", .todo_hr = TRUE},
+        {"http:/\\localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
+        {"http:\\/localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
 
         {"ftp://localhost\\index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
-        {"ftp:/\\localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost", .todo_hr = TRUE},
-        {"ftp:\\/localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost", .todo_hr = TRUE},
+        {"ftp:/\\localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
+        {"ftp:\\/localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
 
         {"http://host?a:b@c:d", URL_PART_HOSTNAME, 0, S_OK, "host"},
         {"http://host?a:b@c:d", URL_PART_QUERY, 0, S_OK, "a:b at c:d"},




More information about the wine-cvs mailing list