[PATCH 1/4] kernelbase: Do not return S_FALSE from UrlGetPartW().

Zebediah Figura zfigura at codeweavers.com
Tue Mar 22 23:28:00 CDT 2022


Only return it from UrlGetPartA().

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/kernelbase/path.c   | 3 ++-
 dlls/shlwapi/tests/url.c | 8 ++------
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index 410d87ce620..be7754dade2 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -4166,6 +4166,7 @@ HRESULT WINAPI UrlGetPartA(const char *url, char *out, DWORD *out_len, DWORD par
     len2 = WideCharToMultiByte(CP_ACP, 0, outW, len + 1, out, *out_len, NULL, NULL);
     *out_len = len2 - 1;
     heap_free(inW);
+    if (hr == S_OK && !*out_len) hr = S_FALSE;
     return hr;
 }
 
@@ -4382,7 +4383,7 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p
     }
     TRACE("len=%ld %s\n", *out_len, wine_dbgstr_w(out));
 
-    return *out_len ? S_OK : S_FALSE;
+    return S_OK;
 }
 
 BOOL WINAPI UrlIsA(const char *url, URLIS Urlis)
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index 476358c6d45..31581f82847 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -748,8 +748,6 @@ static void test_UrlGetPart(void)
         {"telnet://hostname/", URL_PART_HOSTNAME, URL_PARTFLAG_KEEPSCHEME, S_OK, "telnet:hostname"},
     };
 
-    winetest_mute_threshold = 5;
-
     hr = UrlGetPartA(NULL, NULL, NULL, URL_PART_SCHEME, 0);
     ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
@@ -837,7 +835,7 @@ static void test_UrlGetPart(void)
         size = 1;
         wcscpy(bufferW, L"x");
         hr = UrlGetPartW(urlW, bufferW, &size, part, flags);
-        todo_wine_if (tests[i].todo_hr || tests[i].hr == S_FALSE)
+        todo_wine_if (tests[i].todo_hr)
         {
             if (tests[i].hr == S_OK)
                 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
@@ -870,7 +868,7 @@ static void test_UrlGetPart(void)
         size = ARRAY_SIZE(bufferW);
         wcscpy(bufferW, L"x");
         hr = UrlGetPartW(urlW, bufferW, &size, part, flags);
-        todo_wine_if ((tests[i].hr == S_FALSE || tests[i].todo_hr) && strcmp(url, "a:") && strcmp(url, "0:"))
+        todo_wine_if (tests[i].todo_hr && strcmp(url, "a:") && strcmp(url, "0:"))
             ok(hr == (tests[i].hr == S_FALSE ? S_OK : tests[i].hr), "Got hr %#lx.\n", hr);
         if (SUCCEEDED(hr))
         {
@@ -886,8 +884,6 @@ static void test_UrlGetPart(void)
 
         winetest_pop_context();
     }
-
-    winetest_mute_threshold = 42;
 }
 
 /* ########################### */
-- 
2.34.1




More information about the wine-devel mailing list