From c7ea4234441832d7630399daef8d1a0aaa6e9b47 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Sat, 13 Apr 2013 18:52:09 +1000 Subject: [PATCH] kernel32: Fix GetConsoleFontSize() v2 --- 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..5fb910c 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 = 80, lin = 24, 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 = wine_server_user_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 = 80, lin = 24, 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 = wine_server_user_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