Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47288 Signed-off-by: Aaro Altonen a.altonen@hotmail.com --- v2: - Removed an unnecessary check and added a print (thanks Gijs) --- dlls/kernel32/tests/console.c | 10 +++++----- dlls/kernelbase/console.c | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 50f1cd5ee4..7112e6d580 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3165,24 +3165,24 @@ static void test_SetConsoleScreenBufferInfoEx(HANDLE std_output) SetLastError(0xdeadbeef); ret = pSetConsoleScreenBufferInfoEx(NULL, &info); ok(!ret, "got %d, expected zero\n", ret); - todo_wine ok(GetLastError() == ERROR_INVALID_HANDLE, "got %u, expected 6\n", GetLastError()); + ok(GetLastError() == ERROR_INVALID_HANDLE, "got %u, expected 6\n", GetLastError());
SetLastError(0xdeadbeef); ret = pSetConsoleScreenBufferInfoEx(std_output, &info); - todo_wine ok(ret, "got %d, expected one\n", ret); - todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); + ok(ret, "got %d, expected one\n", ret); + ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError());
SetLastError(0xdeadbeef); ret = pSetConsoleScreenBufferInfoEx(std_input, &info); ok(!ret, "got %d, expected zero\n", ret); - todo_wine ok(GetLastError() == ERROR_INVALID_HANDLE || GetLastError() == ERROR_ACCESS_DENIED, + ok(GetLastError() == ERROR_INVALID_HANDLE || GetLastError() == ERROR_ACCESS_DENIED, "got %u, expected 5 or 6\n", GetLastError());
info.cbSize = 0; SetLastError(0xdeadbeef); ret = pSetConsoleScreenBufferInfoEx(std_output, &info); ok(!ret, "got %d, expected zero\n", ret); - todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %u, expected 87\n", GetLastError()); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %u, expected 87\n", GetLastError());
CloseHandle(std_input); } diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c index 91e8129fbe..8ce9252413 100644 --- a/dlls/kernelbase/console.c +++ b/dlls/kernelbase/console.c @@ -1146,9 +1146,36 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleOutputCP( UINT cp ) BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleScreenBufferInfoEx( HANDLE handle, CONSOLE_SCREEN_BUFFER_INFOEX *info ) { - FIXME( "(%p %p): stub!\n", handle, info ); - SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); - return FALSE; + BOOL ret; + + TRACE("(%p, %p)\n", handle, info); + + if (info->cbSize != sizeof(CONSOLE_SCREEN_BUFFER_INFOEX)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + SERVER_START_REQ(set_console_output_info) + { + req->handle = console_handle_unmap(handle); + req->width = info->dwSize.X; + req->height = info->dwSize.Y; + req->cursor_x = info->dwCursorPosition.X; + req->cursor_y = info->dwCursorPosition.Y; + req->attr = info->wAttributes; + req->win_left = info->srWindow.Left; + req->win_top = info->srWindow.Top; + req->win_right = info->srWindow.Right; + req->win_bottom = info->srWindow.Bottom; + req->popup_attr = info->wPopupAttributes; + req->max_width = min(info->dwMaximumWindowSize.X, info->dwSize.X); + req->max_height = min(info->dwMaximumWindowSize.Y, info->dwSize.Y); + ret = !wine_server_call_err(req); + } + SERVER_END_REQ; + + return ret; }