Zebediah Figura : kernelbase: Allow schemes to contain uppercase characters in UrlGetPart().

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


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

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

kernelbase: Allow schemes to contain uppercase characters in UrlGetPart().

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

---

 dlls/kernelbase/path.c   | 15 +++++++++++++--
 dlls/shlwapi/tests/url.c |  2 +-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index 3fdc752938c..0dba2098391 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -4155,7 +4155,7 @@ HRESULT WINAPI UrlGetPartA(const char *url, char *out, DWORD *out_len, DWORD par
 
 static const WCHAR *parse_scheme( const WCHAR *p )
 {
-    while ((*p >= 'a' && *p <= 'z') || (*p >= '0' && *p <= '9') || *p == '+' || *p == '-' || *p == '.')
+    while (isalnum( *p ) || *p == '+' || *p == '-' || *p == '.')
         ++p;
     return p;
 }
@@ -4384,7 +4384,18 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p
             *out_len = size + 1;
             return E_POINTER;
         }
-        memcpy(out, addr, size*sizeof(WCHAR));
+
+        if (part == URL_PART_SCHEME)
+        {
+            unsigned int i;
+
+            for (i = 0; i < size; ++i)
+                out[i] = tolower( addr[i] );
+        }
+        else
+        {
+            memcpy( out, addr, size * sizeof(WCHAR) );
+        }
         out[size] = 0;
         *out_len = size;
     }
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index ae0d0738195..5c28142bc42 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -709,7 +709,7 @@ static void test_UrlGetPart(void)
         {"file://c:\\index.htm", URL_PART_HOSTNAME, URL_PARTFLAG_KEEPSCHEME, S_FALSE, ""},
         {"file:some text", URL_PART_HOSTNAME, 0, S_FALSE, ""},
         {"index.htm", URL_PART_HOSTNAME, 0, E_FAIL},
-        {"sChEmE-.+:", URL_PART_SCHEME, 0, S_OK, "scheme-.+", .todo_hr = TRUE},
+        {"sChEmE-.+:", URL_PART_SCHEME, 0, S_OK, "scheme-.+"},
         {"scheme_:", URL_PART_SCHEME, 0, S_FALSE, ""},
         {"scheme :", URL_PART_SCHEME, 0, S_FALSE, ""},
         {"sch eme:", URL_PART_SCHEME, 0, S_FALSE, ""},




More information about the wine-cvs mailing list