From dd407e590f90bc5dbcad5587f50230fcf4b26192 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Tue, 21 May 2013 12:15:22 +1000 Subject: kernel32: console.c --- dlls/kernel32/console.c | 75 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c index 8405f4f..0e056a6 100644 --- a/dlls/kernel32/console.c +++ b/dlls/kernel32/console.c @@ -1364,6 +1364,26 @@ DWORD WINAPI GetConsoleTitleW(LPWSTR title, DWORD size) return ret; } +/*********************************************************************** + * GetLargestConsoleWindowSize_helper + */ +COORD GetLargestConsoleWindowSize_helper(HANDLE hConsoleOutput) +{ + COORD max_console; + + SERVER_START_REQ(get_console_output_info) + { + req->handle = console_handle_unmap(hConsoleOutput); + if (!wine_server_call_err(req)) + { + max_console.X = reply->max_width; + max_console.Y = reply->max_height; + } + } + SERVER_END_REQ; + + return max_console; +} /*********************************************************************** * GetLargestConsoleWindowSize (KERNEL32.@) @@ -1382,14 +1402,13 @@ DWORD WINAPI GetLargestConsoleWindowSize(HANDLE hConsoleOutput) 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; } #endif /* defined(__i386__) */ - /*********************************************************************** * GetLargestConsoleWindowSize (KERNEL32.@) * @@ -1403,8 +1422,7 @@ DWORD WINAPI GetLargestConsoleWindowSize(HANDLE hConsoleOutput) 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; } @@ -3219,7 +3237,6 @@ BOOL WINAPI AddConsoleAliasW(LPWSTR source, LPWSTR target, LPWSTR exename) return FALSE; } - BOOL WINAPI SetConsoleIcon(HICON icon) { FIXME(": (%p) stub!\n", icon); @@ -3227,39 +3244,55 @@ BOOL WINAPI SetConsoleIcon(HICON icon) return FALSE; } -BOOL WINAPI GetCurrentConsoleFont(HANDLE hConsole, BOOL maxwindow, LPCONSOLE_FONT_INFO fontinfo) +COORD GetConsoleFontSize_helper(HANDLE hConsoleOutput, DWORD nFont) { - FIXME(": (%p, %d, %p) stub!\n", hConsole, maxwindow, fontinfo); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + COORD fontsize; + FIXME(": nFont index not implemented (%p, %d)\n", hConsoleOutput, nFont); + + SERVER_START_REQ(get_console_output_info) + { + req->handle = console_handle_unmap(hConsoleOutput); + if (!wine_server_call_err(req)) + { + fontsize.X = reply->font_width; + fontsize.Y = reply->font_height; + } + } + SERVER_END_REQ; + + return fontsize; +} + +BOOL WINAPI GetCurrentConsoleFont(HANDLE hConsoleOutput, BOOL maxwindow, LPCONSOLE_FONT_INFO fontinfo) +{ + DWORD index = 0; + FIXME(": maxwindow not implemented (%p, %d, %p)\n", hConsoleOutput, maxwindow, fontinfo); + + fontinfo->nFont = index; + fontinfo->dwFontSize = GetConsoleFontSize(hConsoleOutput, index); + + return TRUE; } #ifdef __i386__ #undef GetConsoleFontSize -DWORD WINAPI GetConsoleFontSize(HANDLE hConsole, DWORD font) +DWORD WINAPI GetConsoleFontSize(HANDLE hConsoleOutput, DWORD nFont) { union { COORD c; DWORD w; } x; - FIXME(": (%p, %d) stub!\n", hConsole, font); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - - x.c.X = 0; - x.c.Y = 0; + x.c = GetConsoleFontSize_helper(hConsoleOutput, nFont); return x.w; } #endif /* defined(__i386__) */ - #ifndef __i386__ -COORD WINAPI GetConsoleFontSize(HANDLE hConsole, DWORD font) +COORD WINAPI GetConsoleFontSize(HANDLE hConsoleOutput, DWORD nFont) { COORD c; - c.X = 80; - c.Y = 24; - FIXME(": (%p, %d) stub!\n", hConsole, font); + c = GetConsoleFontSize_helper(hConsoleOutput, nFont); return c; } #endif /* defined(__i386__) */ -- 1.7.10.4