kernelbase: Implement SetConsoleScreenBufferInfoEx().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47288
Signed-off-by: Aaro Altonen <a.altonen@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Aaro Altonen 2020-03-04 09:47:52 +02:00 committed by Alexandre Julliard
parent 723506ef48
commit b21881f53c
2 changed files with 35 additions and 8 deletions

View File

@ -3167,24 +3167,24 @@ static void test_SetConsoleScreenBufferInfoEx(HANDLE std_output)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pSetConsoleScreenBufferInfoEx(NULL, &info); ret = pSetConsoleScreenBufferInfoEx(NULL, &info);
ok(!ret, "got %d, expected zero\n", ret); 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); SetLastError(0xdeadbeef);
ret = pSetConsoleScreenBufferInfoEx(std_output, &info); ret = pSetConsoleScreenBufferInfoEx(std_output, &info);
todo_wine ok(ret, "got %d, expected one\n", ret); ok(ret, "got %d, expected one\n", ret);
todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pSetConsoleScreenBufferInfoEx(std_input, &info); ret = pSetConsoleScreenBufferInfoEx(std_input, &info);
ok(!ret, "got %d, expected zero\n", ret); 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()); "got %u, expected 5 or 6\n", GetLastError());
info.cbSize = 0; info.cbSize = 0;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pSetConsoleScreenBufferInfoEx(std_output, &info); ret = pSetConsoleScreenBufferInfoEx(std_output, &info);
ok(!ret, "got %d, expected zero\n", ret); 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); CloseHandle(std_input);
} }

View File

@ -1146,9 +1146,36 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleOutputCP( UINT cp )
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleScreenBufferInfoEx( HANDLE handle, BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleScreenBufferInfoEx( HANDLE handle,
CONSOLE_SCREEN_BUFFER_INFOEX *info ) CONSOLE_SCREEN_BUFFER_INFOEX *info )
{ {
FIXME( "(%p %p): stub!\n", handle, info ); BOOL ret;
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
TRACE("(%p, %p)\n", handle, info);
if (info->cbSize != sizeof(CONSOLE_SCREEN_BUFFER_INFOEX))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; 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;
} }