Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47620 Signed-off-by: Gijs Vermeulen gijsvrm@codeweavers.com --- dlls/kernel32/console.c | 31 +++++++++++++++++++++++++++++-- dlls/kernel32/kernel32.spec | 2 +- 2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c index f99b1dba49..0566430aa7 100644 --- a/dlls/kernel32/console.c +++ b/dlls/kernel32/console.c @@ -3290,17 +3290,23 @@ BOOL WINAPI SetConsoleKeyShortcuts(BOOL set, BYTE keys, VOID *a, DWORD b) }
-BOOL WINAPI GetCurrentConsoleFont(HANDLE hConsole, BOOL maxwindow, LPCONSOLE_FONT_INFO fontinfo) +BOOL WINAPI GetCurrentConsoleFontEx(HANDLE hConsole, BOOL maxwindow, CONSOLE_FONT_INFOEX *fontinfo) { BOOL ret;
- memset(fontinfo, 0, sizeof(CONSOLE_FONT_INFO)); + if (fontinfo->cbSize != sizeof(CONSOLE_FONT_INFOEX)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + }
SERVER_START_REQ(get_console_output_info) { req->handle = console_handle_unmap(hConsole); + wine_server_set_reply(req, fontinfo->FaceName, sizeof(fontinfo->FaceName) - sizeof(WCHAR)); if ((ret = !wine_server_call_err(req))) { + fontinfo->nFont = 0; if (maxwindow) { fontinfo->dwFontSize.X = min(reply->width, reply->max_width); @@ -3311,12 +3317,33 @@ BOOL WINAPI GetCurrentConsoleFont(HANDLE hConsole, BOOL maxwindow, LPCONSOLE_FON fontinfo->dwFontSize.X = reply->win_right - reply->win_left + 1; fontinfo->dwFontSize.Y = reply->win_bottom - reply->win_top + 1; } + + fontinfo->FontFamily = reply->font_pitch_family; + fontinfo->FontWeight = reply->font_weight; + fontinfo->FaceName[ARRAY_SIZE(fontinfo->FaceName) - 1] = 0; } } SERVER_END_REQ; return ret; }
+BOOL WINAPI GetCurrentConsoleFont(HANDLE hConsole, BOOL maxwindow, CONSOLE_FONT_INFO *fontinfo) +{ + BOOL ret; + CONSOLE_FONT_INFOEX res; + + res.cbSize = sizeof(CONSOLE_FONT_INFOEX); + + ret = GetCurrentConsoleFontEx(hConsole, maxwindow, &res); + if(ret) + { + fontinfo->nFont = res.nFont; + fontinfo->dwFontSize.X = res.dwFontSize.X; + fontinfo->dwFontSize.Y = res.dwFontSize.Y; + } + return ret; +} + static COORD get_console_font_size(HANDLE hConsole, DWORD index) { COORD c = {0,0}; diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index b562c748c7..5f26806c62 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -623,7 +623,7 @@ @ stdcall GetCurrencyFormatW(long long wstr ptr ptr long) @ stdcall -import GetCurrentActCtx(ptr) @ stdcall GetCurrentConsoleFont(long long ptr) -# @ stub GetCurrentConsoleFontEx +@ stdcall GetCurrentConsoleFontEx(long long ptr) @ stdcall GetCurrentDirectoryA(long ptr) @ stdcall GetCurrentDirectoryW(long ptr) @ stdcall GetCurrentPackageFamilyName(ptr ptr)