Hugh McMaster : kernel32: Implement GetConsoleScreenBufferInfoEx.

Alexandre Julliard julliard at winehq.org
Wed Aug 17 10:24:24 CDT 2016


Module: wine
Branch: master
Commit: 2bda84a410fbb0e354316313126b24085c294fc8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2bda84a410fbb0e354316313126b24085c294fc8

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Wed Aug 17 01:35:53 2016 +0000

kernel32: Implement GetConsoleScreenBufferInfoEx.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 cc2936d..51061de 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 826ed43..24f15d4 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)




More information about the wine-cvs mailing list