From: Hugh McMaster Subject: [PATCH] kernel32: Implement SetConsoleFont Message-Id: Date: Tue, 19 Jul 2016 12:34:12 +0000 Signed-off-by: Hugh McMaster --- dlls/kernel32/console.c | 27 ++++++++++++++++++++++++--- dlls/kernel32/tests/console.c | 6 +++--- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c index cc2936d..17410fc 100644 --- a/dlls/kernel32/console.c +++ b/dlls/kernel32/console.c @@ -3262,9 +3262,30 @@ DWORD WINAPI GetNumberOfConsoleFonts(void) BOOL WINAPI SetConsoleFont(HANDLE hConsole, DWORD index) { - FIXME("(%p, %u): stub!\n", hConsole, index); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + BOOL ret; + COORD c; + + if (index >= GetNumberOfConsoleFonts()) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + c = GetConsoleFontSize(hConsole, index); + if (!c.X || !c.Y) + return FALSE; + + SERVER_START_REQ(set_console_output_info) + { + req->handle = console_handle_unmap(hConsole); + req->font_width = c.X; + req->font_height = c.Y; + req->mask = SET_CONSOLE_OUTPUT_INFO_FONT; + ret = !wine_server_call_err(req); + } + SERVER_END_REQ; + + return ret; } BOOL WINAPI SetConsoleKeyShortcuts(BOOL set, BYTE keys, VOID *a, DWORD b) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 5b66d9f..1d1d890 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -2916,12 +2916,12 @@ static void test_SetConsoleFont(HANDLE std_output) SetLastError(0xdeadbeef); ret = pSetConsoleFont(NULL, 0); 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 = pSetConsoleFont(GetStdHandle(STD_INPUT_HANDLE), 0); 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()); pGetNumberOfConsoleFonts = (void *)GetProcAddress(hmod, "GetNumberOfConsoleFonts"); if (!pGetNumberOfConsoleFonts) @@ -2935,7 +2935,7 @@ static void test_SetConsoleFont(HANDLE std_output) SetLastError(0xdeadbeef); ret = pSetConsoleFont(std_output, num_fonts); 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()); } START_TEST(console) -- 2.7.4