Zebediah Figura : kernelbase: Return E_INVALIDARG when requesting URL_PART_PORT and there is no port.

Alexandre Julliard julliard at winehq.org
Wed Feb 16 15:30:22 CST 2022


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Tue Feb 15 21:52:14 2022 -0600

kernelbase: Return E_INVALIDARG when requesting URL_PART_PORT and there is no port.

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

---

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

diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index fbb4c5152a9..e29ee585123 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -4347,6 +4347,8 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p
         break;
 
     case URL_PART_PORT:
+        if (!pl.port)
+            return E_INVALIDARG;
         if (!pl.port_len)
         {
             *out = '\0';
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index 54342d1e5c2..18af0906e08 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -624,7 +624,7 @@ static void test_UrlGetPart(void)
         {"http://localhost/", URL_PART_USERNAME, 0, E_INVALIDARG},
         {"http://localhost/", URL_PART_PASSWORD, 0, E_INVALIDARG},
         {"http://localhost/", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
-        {"http://localhost/", URL_PART_PORT, 0, E_INVALIDARG, .todo_hr = TRUE},
+        {"http://localhost/", URL_PART_PORT, 0, E_INVALIDARG},
         {"http://localhost/", URL_PART_QUERY, 0, S_FALSE, ""},
 
         {"http://localhost:port/", URL_PART_USERNAME, 0, E_INVALIDARG},
@@ -637,7 +637,7 @@ static void test_UrlGetPart(void)
         {"http://user@localhost", URL_PART_USERNAME, 0, S_OK, "user"},
         {"http://user@localhost", URL_PART_PASSWORD, 0, E_INVALIDARG},
         {"http://user@localhost", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
-        {"http://user@localhost", URL_PART_PORT, 0, E_INVALIDARG, .todo_hr = TRUE},
+        {"http://user@localhost", URL_PART_PORT, 0, E_INVALIDARG},
         {"http://@", URL_PART_USERNAME, 0, S_FALSE, ""},
         {"http://@", URL_PART_PASSWORD, 0, E_INVALIDARG},
         {"http://@", URL_PART_HOSTNAME, 0, S_FALSE, ""},
@@ -645,7 +645,7 @@ static void test_UrlGetPart(void)
         {"http://user:pass@localhost", URL_PART_USERNAME, 0, S_OK, "user"},
         {"http://user:pass@localhost", URL_PART_PASSWORD, 0, S_OK, "pass"},
         {"http://user:pass@localhost", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
-        {"http://user:pass@localhost", URL_PART_PORT, 0, E_INVALIDARG, .todo_hr = TRUE},
+        {"http://user:pass@localhost", URL_PART_PORT, 0, E_INVALIDARG},
         {"http://:@", URL_PART_USERNAME, 0, S_FALSE, ""},
         {"http://:@", URL_PART_PASSWORD, 0, S_FALSE, ""},
         {"http://:@", URL_PART_HOSTNAME, 0, S_FALSE, ""},




More information about the wine-cvs mailing list