From 8a93836a561b90c752995882b2af27a39071cc13 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Wed, 10 Apr 2013 21:59:44 +1000 Subject: Fix GetConsoleFontSize --- dlls/kernel32/console.c | 65 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 8 deletions(-) diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c index d6d1414..07dd8a0 100644 --- a/dlls/kernel32/console.c +++ b/dlls/kernel32/console.c @@ -3236,28 +3236,77 @@ BOOL WINAPI GetCurrentConsoleFont(HANDLE hConsole, BOOL maxwindow, LPCONSOLE_FON #undef GetConsoleFontSize DWORD WINAPI GetConsoleFontSize(HANDLE hConsole, DWORD font) { + int col = 0, lin = 0, colpix = 0, linpix = 0; + HWND hWnd; + union { COORD c; DWORD w; } x; - FIXME(": (%p, %d) stub!\n", hConsole, font); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + SERVER_START_REQ( get_console_output_info ) + { + req->handle = console_handle_unmap(hConsole); + if (!wine_server_call_err( req )) + { + col = (reply->win_right - reply->win_left) + 1; + lin = (reply->win_bottom - reply->win_top) + 1; + } + } + SERVER_END_REQ; + + hWnd = GetConsoleWindow(); - x.c.X = 0; - x.c.Y = 0; + SERVER_START_REQ( get_window_rectangles ) + { + req->handle = hWnd; + if (!wine_server_call_err( req )) + { + colpix = reply->client.right - reply->client.left; + linpix = reply->client.bottom - reply->client.top; + } + } + SERVER_END_REQ; + + x.c.X = colpix / col; + x.c.Y = linpix / lin; return x.w; } #endif /* defined(__i386__) */ - #ifndef __i386__ COORD WINAPI GetConsoleFontSize(HANDLE hConsole, DWORD font) { + int col = 0, lin = 0, colpix = 0, linpix = 0; + HWND hWnd; COORD c; - c.X = 80; - c.Y = 24; - FIXME(": (%p, %d) stub!\n", hConsole, font); + + SERVER_START_REQ( get_console_output_info ) + { + req->handle = console_handle_unmap(hConsole); + if (!wine_server_call_err( req )) + { + col = (reply->win_right - reply->win_left) + 1; + lin = (reply->win_bottom - reply->win_top) + 1; + } + } + SERVER_END_REQ; + + hWnd = GetConsoleWindow(); + + SERVER_START_REQ( get_window_rectangles ) + { + req->handle = hWnd; + if (!wine_server_call_err( req )) + { + colpix = reply->client.right - reply->client.left; + linpix = reply->client.bottom - reply->client.top; + } + } + SERVER_END_REQ; + + c.X = colpix / col; + c.Y = linpix / lin; return c; } #endif /* defined(__i386__) */ -- 1.7.10.4