From 2bda84a410fbb0e354316313126b24085c294fc8 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Wed, 17 Aug 2016 01:35:53 +0000 Subject: [PATCH] kernel32: Implement GetConsoleScreenBufferInfoEx. Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard --- dlls/kernel32/console.c | 35 ++++++++++++++++++++++++++++++++--- dlls/kernel32/tests/console.c | 14 +++++++------- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c index cc2936d2d88..51061de922c 100644 --- a/dlls/kernel32/console.c +++ b/dlls/kernel32/console.c @@ -3356,9 +3356,38 @@ BOOL WINAPI GetConsoleFontInfo(HANDLE hConsole, BOOL maximize, DWORD numfonts, C BOOL WINAPI GetConsoleScreenBufferInfoEx(HANDLE hConsole, CONSOLE_SCREEN_BUFFER_INFOEX *csbix) { - FIXME("(%p %p): stub!\n", hConsole, csbix); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + BOOL ret; + + if (csbix->cbSize != sizeof(CONSOLE_SCREEN_BUFFER_INFOEX)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + SERVER_START_REQ(get_console_output_info) + { + req->handle = console_handle_unmap(hConsole); + wine_server_set_reply(req, csbix->ColorTable, sizeof(csbix->ColorTable)); + if ((ret = !wine_server_call_err(req))) + { + csbix->dwSize.X = reply->width; + csbix->dwSize.Y = reply->height; + csbix->dwCursorPosition.X = reply->cursor_x; + csbix->dwCursorPosition.Y = reply->cursor_y; + csbix->wAttributes = reply->attr; + csbix->srWindow.Left = reply->win_left; + csbix->srWindow.Top = reply->win_top; + csbix->srWindow.Right = reply->win_right; + csbix->srWindow.Bottom = reply->win_bottom; + csbix->dwMaximumWindowSize.X = min(reply->width, reply->max_width); + csbix->dwMaximumWindowSize.Y = min(reply->height, reply->max_height); + csbix->wPopupAttributes = reply->popup_attr; + csbix->bFullscreenSupported = FALSE; + } + } + SERVER_END_REQ; + + return ret; } BOOL WINAPI SetConsoleScreenBufferInfoEx(HANDLE hConsole, CONSOLE_SCREEN_BUFFER_INFOEX *csbix) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 826ed43d466..24f15d4c2ab 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -2957,34 +2957,34 @@ static void test_GetConsoleScreenBufferInfoEx(HANDLE std_output) SetLastError(0xdeadbeef); ret = pGetConsoleScreenBufferInfoEx(NULL, &csbix); 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()); SetLastError(0xdeadbeef); ret = pGetConsoleScreenBufferInfoEx(std_input, &csbix); 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()); SetLastError(0xdeadbeef); ret = pGetConsoleScreenBufferInfoEx(std_output, &csbix); 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()); csbix.cbSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX); SetLastError(0xdeadbeef); ret = pGetConsoleScreenBufferInfoEx(NULL, &csbix); 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 = pGetConsoleScreenBufferInfoEx(std_input, &csbix); 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 = pGetConsoleScreenBufferInfoEx(std_output, &csbix); - todo_wine ok(ret, "got %d, expected non-zero\n", ret); - todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); + ok(ret, "got %d, expected non-zero\n", ret); + ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); } START_TEST(console)