[PATCH 0/2] MR6091: winhttp/tests: Add some more tests for string options in WinHttpQueryOption().
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6091
From: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/winhttp/tests/winhttp.c | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index a1f8c15e356..6e814247167 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -3332,6 +3332,15 @@ static void test_redirect(int port) ok(ret, "got %lu\n", GetLastError()); ok(!wcscmp(url, expected), "expected %s got %s\n", wine_dbgstr_w(expected), wine_dbgstr_w(url)); + /* Exact buffer size match. */ + url[0] = 0; + size = (lstrlenW(expected) + 1) * sizeof(WCHAR); + ret = WinHttpQueryOption(req, WINHTTP_OPTION_URL, url, &size); + todo_wine + ok(ret, "got %lu\n", GetLastError()); + todo_wine + ok(!wcscmp(url, expected), "expected %s got %s\n", wine_dbgstr_w(expected), wine_dbgstr_w(url)); + ret = WinHttpReceiveResponse(req, NULL); ok(ret, "failed to receive response %lu\n", GetLastError()); @@ -4417,6 +4426,17 @@ static void test_credentials(void) ok(!wcscmp(buffer, proxy_userW), "unexpected result %s\n", wine_dbgstr_w(buffer)); ok(size == lstrlenW(proxy_userW) * sizeof(WCHAR), "unexpected result %lu\n", size); + /* Exact buffer size match. */ + size = (lstrlenW(proxy_userW) + 1) * sizeof(WCHAR); + buffer[0] = 0; + ret = WinHttpQueryOption(req, WINHTTP_OPTION_PROXY_USERNAME, &buffer, &size); + todo_wine + ok(ret, "failed to query proxy username %lu\n", GetLastError()); + todo_wine + ok(!wcscmp(buffer, proxy_userW), "unexpected result %s\n", wine_dbgstr_w(buffer)); + todo_wine + ok(size == lstrlenW(proxy_userW) * sizeof(WCHAR), "unexpected result %lu\n", size); + buffer[0] = 0x1; SetLastError(0xdeadbeef); ret = WinHttpQueryOption(req, WINHTTP_OPTION_PROXY_USERNAME, &buffer, &size); @@ -4463,6 +4483,17 @@ static void test_credentials(void) ok(!wcscmp(buffer, proxy_passW), "unexpected result %s\n", wine_dbgstr_w(buffer)); ok(size == lstrlenW(proxy_passW) * sizeof(WCHAR), "unexpected result %lu\n", size); + /* Exact buffer size match. */ + size = (lstrlenW(proxy_passW) + 1) * sizeof(WCHAR); + buffer[0] = 0; + ret = WinHttpQueryOption(req, WINHTTP_OPTION_PROXY_PASSWORD, &buffer, &size); + todo_wine + ok(ret, "failed to query proxy password %lu\n", GetLastError()); + todo_wine + ok(!wcscmp(buffer, proxy_passW), "unexpected result %s\n", wine_dbgstr_w(buffer)); + todo_wine + ok(size == lstrlenW(proxy_passW) * sizeof(WCHAR), "unexpected result %lu\n", size); + buffer[0] = 0x1; SetLastError(0xdeadbeef); ret = WinHttpQueryOption(req, WINHTTP_OPTION_PROXY_PASSWORD, &buffer, &size); @@ -4485,6 +4516,17 @@ static void test_credentials(void) ok(!wcscmp(buffer, userW), "unexpected result %s\n", wine_dbgstr_w(buffer)); ok(size == lstrlenW(userW) * sizeof(WCHAR), "unexpected result %lu\n", size); + /* Exact buffer size match. */ + size = (lstrlenW(userW) + 1) * sizeof(WCHAR); + buffer[0] = 0; + ret = WinHttpQueryOption(req, WINHTTP_OPTION_USERNAME, &buffer, &size); + todo_wine + ok(ret, "failed to query username %lu\n", GetLastError()); + todo_wine + ok(!wcscmp(buffer, userW), "unexpected result %s\n", wine_dbgstr_w(buffer)); + todo_wine + ok(size == lstrlenW(userW) * sizeof(WCHAR), "unexpected result %lu\n", size); + buffer[0] = 0x1; SetLastError(0xdeadbeef); ret = WinHttpQueryOption(req, WINHTTP_OPTION_USERNAME, &buffer, &size); @@ -4507,6 +4549,17 @@ static void test_credentials(void) ok(!wcscmp(buffer, passW), "unexpected result %s\n", wine_dbgstr_w(buffer)); ok(size == lstrlenW(passW) * sizeof(WCHAR), "unexpected result %lu\n", size); + /* Exact buffer size match. */ + buffer[0] = 0; + size = (lstrlenW(passW) + 1) * sizeof(WCHAR); + ret = WinHttpQueryOption(req, WINHTTP_OPTION_PASSWORD, &buffer, &size); + todo_wine + ok(ret, "failed to query password %lu\n", GetLastError()); + todo_wine + ok(!wcscmp(buffer, passW), "unexpected result %s\n", wine_dbgstr_w(buffer)); + todo_wine + ok(size == lstrlenW(passW) * sizeof(WCHAR), "unexpected result %lu\n", size); + buffer[0] = 0x1; SetLastError(0xdeadbeef); ret = WinHttpQueryOption(req, WINHTTP_OPTION_PASSWORD, &buffer, &size); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6091
From: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/winhttp/session.c | 2 +- dlls/winhttp/tests/winhttp.c | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index d579d72583e..e8e286145ca 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -685,7 +685,7 @@ static BOOL return_string_option( WCHAR *buffer, const WCHAR *str, LPDWORD bufle { int len = sizeof(WCHAR); if (str) len += lstrlenW( str ) * sizeof(WCHAR); - if (buffer && *buflen > len) + if (buffer && *buflen >= len) { if (str) memcpy( buffer, str, len ); len -= sizeof(WCHAR); diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 6e814247167..2e086222aba 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -3336,9 +3336,7 @@ static void test_redirect(int port) url[0] = 0; size = (lstrlenW(expected) + 1) * sizeof(WCHAR); ret = WinHttpQueryOption(req, WINHTTP_OPTION_URL, url, &size); - todo_wine ok(ret, "got %lu\n", GetLastError()); - todo_wine ok(!wcscmp(url, expected), "expected %s got %s\n", wine_dbgstr_w(expected), wine_dbgstr_w(url)); ret = WinHttpReceiveResponse(req, NULL); @@ -4430,11 +4428,8 @@ static void test_credentials(void) size = (lstrlenW(proxy_userW) + 1) * sizeof(WCHAR); buffer[0] = 0; ret = WinHttpQueryOption(req, WINHTTP_OPTION_PROXY_USERNAME, &buffer, &size); - todo_wine ok(ret, "failed to query proxy username %lu\n", GetLastError()); - todo_wine ok(!wcscmp(buffer, proxy_userW), "unexpected result %s\n", wine_dbgstr_w(buffer)); - todo_wine ok(size == lstrlenW(proxy_userW) * sizeof(WCHAR), "unexpected result %lu\n", size); buffer[0] = 0x1; @@ -4487,11 +4482,8 @@ static void test_credentials(void) size = (lstrlenW(proxy_passW) + 1) * sizeof(WCHAR); buffer[0] = 0; ret = WinHttpQueryOption(req, WINHTTP_OPTION_PROXY_PASSWORD, &buffer, &size); - todo_wine ok(ret, "failed to query proxy password %lu\n", GetLastError()); - todo_wine ok(!wcscmp(buffer, proxy_passW), "unexpected result %s\n", wine_dbgstr_w(buffer)); - todo_wine ok(size == lstrlenW(proxy_passW) * sizeof(WCHAR), "unexpected result %lu\n", size); buffer[0] = 0x1; @@ -4520,11 +4512,8 @@ static void test_credentials(void) size = (lstrlenW(userW) + 1) * sizeof(WCHAR); buffer[0] = 0; ret = WinHttpQueryOption(req, WINHTTP_OPTION_USERNAME, &buffer, &size); - todo_wine ok(ret, "failed to query username %lu\n", GetLastError()); - todo_wine ok(!wcscmp(buffer, userW), "unexpected result %s\n", wine_dbgstr_w(buffer)); - todo_wine ok(size == lstrlenW(userW) * sizeof(WCHAR), "unexpected result %lu\n", size); buffer[0] = 0x1; @@ -4553,11 +4542,8 @@ static void test_credentials(void) buffer[0] = 0; size = (lstrlenW(passW) + 1) * sizeof(WCHAR); ret = WinHttpQueryOption(req, WINHTTP_OPTION_PASSWORD, &buffer, &size); - todo_wine ok(ret, "failed to query password %lu\n", GetLastError()); - todo_wine ok(!wcscmp(buffer, passW), "unexpected result %s\n", wine_dbgstr_w(buffer)); - todo_wine ok(size == lstrlenW(passW) * sizeof(WCHAR), "unexpected result %lu\n", size); buffer[0] = 0x1; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6091
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details: The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147135 Your paranoid android. === debian11b (64 bit WoW report) === ddraw: ddraw2.c:3735: Test failed: Expected screen size 1024x768, got 0x0.
This merge request was approved by Hans Leidekker. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6091
participants (4)
-
Hans Leidekker (@hans) -
Marvin -
Nikolay Sivov -
Nikolay Sivov (@nsivov)