Aaro Altonen : kernelbase: Implement SetConsoleScreenBufferInfoEx().

Alexandre Julliard julliard at winehq.org
Thu Mar 5 16:35:27 CST 2020


Module: wine
Branch: master
Commit: b21881f53c6b88523b3eaf6281be8c7a05258ce0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b21881f53c6b88523b3eaf6281be8c7a05258ce0

Author: Aaro Altonen <a.altonen at hotmail.com>
Date:   Wed Mar  4 09:47:52 2020 +0200

kernelbase: Implement SetConsoleScreenBufferInfoEx().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47288
Signed-off-by: Aaro Altonen <a.altonen at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 8f19161c9c..9698f11779 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -3167,24 +3167,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..b9843850c8 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;
 }
 
 




More information about the wine-cvs mailing list