--- dlls/kernel32/console.c.orig 2013-03-30 05:19:16.000000000 +1100 +++ dlls/kernel32/console.c 2013-04-10 21:56:21.071967727 +1000 @@ -1364,6 +1364,37 @@ /*********************************************************************** + * GetLargestConsoleWindowSize_helper + */ +COORD GetLargestConsoleWindowSize_helper(HANDLE hConsoleOutput) +{ + int screen_width = 0, screen_height = 0; + COORD fontsize, max_console; + + SERVER_START_REQ( get_desktop_workarea ) + { + if(!wine_server_call_err( req )) + { + screen_width = reply->screen_x; + screen_height = reply->screen_y; + } + } + SERVER_END_REQ; + + fontsize = GetConsoleFontSize(hConsoleOutput, 0); + + max_console.X = (screen_width / fontsize.X) - 6; + max_console.Y = (screen_height / fontsize.Y) - 5; + + if (max_console.X < 0 || max_console.Y < 0) + { + max_console.X = 80; + max_console.Y = 25; + } + return max_console; +} + +/*********************************************************************** * GetLargestConsoleWindowSize (KERNEL32.@) * * NOTE @@ -1380,8 +1411,7 @@ COORD c; DWORD w; } x; - x.c.X = 80; - x.c.Y = 24; + x.c = GetLargestConsoleWindowSize_helper(hConsoleOutput); TRACE("(%p), returning %dx%d (%x)\n", hConsoleOutput, x.c.X, x.c.Y, x.w); return x.w; } @@ -1401,8 +1431,7 @@ COORD WINAPI GetLargestConsoleWindowSize(HANDLE hConsoleOutput) { COORD c; - c.X = 80; - c.Y = 24; + c = GetLargestConsoleWindowSize_helper(hConsoleOutput); TRACE("(%p), returning %dx%d\n", hConsoleOutput, c.X, c.Y); return c; } @@ -3236,28 +3265,77 @@ #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__) */