Module: wine Branch: master Commit: 2934ce5cd467ee12f2ed7235f1de445a268e9f63 URL: https://source.winehq.org/git/wine.git/?a=commit;h=2934ce5cd467ee12f2ed7235f...
Author: Paul Gofman pgofman@codeweavers.com Date: Wed Mar 2 18:28:21 2022 +0300
winhttp: Return default value for WINHTTP_OPTION_WORKER_THREAD_COUNT.
Signed-off-by: Paul Gofman pgofman@codeweavers.com Signed-off-by: Hans Leidekker hans@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winhttp/session.c | 9 +++++++++ dlls/winhttp/tests/winhttp.c | 27 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+)
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 971c51ada4f..7c55adb8475 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -1224,6 +1224,15 @@ static BOOL query_option( struct object_header *hdr, DWORD option, void *buffer,
switch (option) { + case WINHTTP_OPTION_WORKER_THREAD_COUNT: + { + FIXME( "WINHTTP_OPTION_WORKER_THREAD_COUNT semi-stub.\n" ); + if (!validate_buffer( buffer, buflen, sizeof(DWORD) )) return FALSE; + + *(DWORD *)buffer = 0; + *buflen = sizeof(DWORD); + return TRUE; + } case WINHTTP_OPTION_CONTEXT_VALUE: { if (!validate_buffer( buffer, buflen, sizeof(DWORD_PTR) )) return FALSE; diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 35f6bc5cf26..9dc8ece3069 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -94,6 +94,15 @@ static void test_WinHttpQueryOption(void) ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER, got %lu\n", GetLastError() ); ok( size == 4, "expected 4, got %lu\n", size );
+ feature = 0xdeadbeef; + size = sizeof(feature) + 1; + SetLastError(0xdeadbeef); + ret = WinHttpQueryOption(session, WINHTTP_OPTION_WORKER_THREAD_COUNT, &feature, &size); + ok(ret, "failed to query option %lu\n", GetLastError()); + ok(GetLastError() == ERROR_SUCCESS, "got %lu\n", GetLastError()); + ok(size == sizeof(feature), "WinHttpQueryOption should set the size: %lu\n", size); + ok(feature == 0, "got unexpected WINHTTP_OPTION_WORKER_THREAD_COUNT %#lx\n", feature); + feature = 0xdeadbeef; size = sizeof(feature) + 1; SetLastError(0xdeadbeef); @@ -165,6 +174,24 @@ static void test_WinHttpQueryOption(void) goto done; }
+ feature = 0xdeadbeef; + size = sizeof(feature); + SetLastError(0xdeadbeef); + ret = WinHttpQueryOption(connection, WINHTTP_OPTION_WORKER_THREAD_COUNT, &feature, &size); + ok(ret, "query WINHTTP_OPTION_WORKER_THREAD_COUNT failed for a request\n"); + ok(GetLastError() == ERROR_SUCCESS, "got unexpected error %lu\n", GetLastError()); + ok(size == sizeof(feature), "WinHttpQueryOption should set the size: %lu\n", size); + ok(feature == 0, "got unexpected WINHTTP_OPTION_WORKER_THREAD_COUNT %#lx\n", feature); + + feature = 0xdeadbeef; + size = sizeof(feature); + SetLastError(0xdeadbeef); + ret = WinHttpQueryOption(request, WINHTTP_OPTION_WORKER_THREAD_COUNT, &feature, &size); + ok(ret, "query WINHTTP_OPTION_WORKER_THREAD_COUNT failed for a request\n"); + ok(GetLastError() == ERROR_SUCCESS, "got unexpected error %lu\n", GetLastError()); + ok(size == sizeof(feature), "WinHttpQueryOption should set the size: %lu\n", size); + ok(feature == 0, "got unexpected WINHTTP_OPTION_WORKER_THREAD_COUNT %#lx\n", feature); + feature = 0xdeadbeef; size = sizeof(feature); SetLastError(0xdeadbeef);