Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/kernelbase/path.c | 34 ++++++++++++++++++---------------- dlls/shlwapi/tests/url.c | 6 +++--- 2 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c index b753ce3dd2e..28717c25f79 100644 --- a/dlls/kernelbase/path.c +++ b/dlls/kernelbase/path.c @@ -4329,6 +4329,24 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p
hr = parse_url(url, &pl);
+ switch (scheme) + { + case URL_SCHEME_FILE: + case URL_SCHEME_FTP: + case URL_SCHEME_GOPHER: + case URL_SCHEME_HTTP: + case URL_SCHEME_HTTPS: + case URL_SCHEME_TELNET: + case URL_SCHEME_NEWS: + case URL_SCHEME_NNTP: + case URL_SCHEME_SNEWS: + break; + + default: + if (part != URL_PART_SCHEME && part != URL_PART_QUERY) + return E_FAIL; + } + switch (part) { case URL_PART_SCHEME: @@ -4344,22 +4362,6 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p break;
case URL_PART_HOSTNAME: - switch (scheme) - { - case URL_SCHEME_FILE: - case URL_SCHEME_FTP: - case URL_SCHEME_GOPHER: - case URL_SCHEME_HTTP: - case URL_SCHEME_HTTPS: - case URL_SCHEME_TELNET: - case URL_SCHEME_NEWS: - case URL_SCHEME_NNTP: - case URL_SCHEME_SNEWS: - break; - default: - return E_FAIL; - } - if (scheme == URL_SCHEME_FILE && (!pl.hostname_len || (pl.hostname_len == 1 && *(pl.hostname + 1) == ':'))) { *out = '\0'; diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c index 729b069a772..904d3e7bb5b 100644 --- a/dlls/shlwapi/tests/url.c +++ b/dlls/shlwapi/tests/url.c @@ -601,10 +601,10 @@ static void test_UrlGetPart(void) tests[] = { {"hi", URL_PART_SCHEME, 0, S_FALSE, ""}, - {"hi", URL_PART_USERNAME, 0, E_FAIL, .todo_hr = TRUE}, - {"hi", URL_PART_PASSWORD, 0, E_FAIL, .todo_hr = TRUE}, + {"hi", URL_PART_USERNAME, 0, E_FAIL}, + {"hi", URL_PART_PASSWORD, 0, E_FAIL}, {"hi", URL_PART_HOSTNAME, 0, E_FAIL}, - {"hi", URL_PART_PORT, 0, E_FAIL, .todo_hr = TRUE}, + {"hi", URL_PART_PORT, 0, E_FAIL}, {"hi", URL_PART_QUERY, 0, S_FALSE, ""},
{"http://foo:bar@localhost:21/internal.php?query=x&return=y", URL_PART_SCHEME, 0, S_OK, "http"},