[2/2] kernel32: Add GetConsoleFontSize stub

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue Aug 21 04:44:34 CDT 2012


Hi,


Changelog:
     kernel32: Add GetConsoleFontSize stub


Best Regards
  Alistair Leslie-Hughes
-------------- next part --------------
>From f3eba1d1bcb01c5c0656c392ab7eb6a63f2658f6 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Mon, 20 Aug 2012 14:45:03 +1000
Subject: [PATCH] Add GetConsoleFontSize stub
To: wine-patches <wine-patches at winehq.org>

---
 dlls/kernel32/console.c     |   28 ++++++++++++++++++++++++++++
 dlls/kernel32/kernel32.spec |    2 +-
 include/wincon.h            |   22 +++++++++++++++++++++-
 3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index e81598f..d6d1414 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -3230,6 +3230,34 @@ BOOL WINAPI GetCurrentConsoleFont(HANDLE hConsole, BOOL maxwindow, LPCONSOLE_FON
     FIXME(": (%p, %d, %p) stub!\n", hConsole, maxwindow, fontinfo);
     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     return FALSE;
+}
+
+#ifdef __i386__
+#undef GetConsoleFontSize
+DWORD WINAPI GetConsoleFontSize(HANDLE hConsole, DWORD font)
+{
+    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;
+    return x.w;
 }
+#endif /* defined(__i386__) */
 
+
+#ifndef __i386__
+COORD WINAPI GetConsoleFontSize(HANDLE hConsole, DWORD font)
+{
+    COORD c;
+    c.X = 80;
+    c.Y = 24;
+     FIXME(": (%p, %d) stub!\n", hConsole, font);
+    return c;
+}
+#endif /* defined(__i386__) */
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index b263818..f9f8685 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -475,7 +475,7 @@
 @ stub GetConsoleCursorMode
 @ stdcall GetConsoleDisplayMode(ptr)
 @ stub GetConsoleFontInfo
-@ stub GetConsoleFontSize
+@ stdcall GetConsoleFontSize(long long)
 @ stub GetConsoleHardwareState
 @ stdcall GetConsoleInputExeNameA(long ptr)
 @ stdcall GetConsoleInputExeNameW(long ptr)
diff --git a/include/wincon.h b/include/wincon.h
index 1cf9428..de96f9a 100644
--- a/include/wincon.h
+++ b/include/wincon.h
@@ -316,7 +316,27 @@ WINBASEAPI DWORD WINAPI  GetConsoleAliasExesLengthW(VOID);
 WINBASEAPI UINT WINAPI   GetConsoleCP(VOID);
 WINBASEAPI BOOL WINAPI   GetConsoleCursorInfo( HANDLE,LPCONSOLE_CURSOR_INFO);
 WINBASEAPI BOOL WINAPI   GetConsoleDisplayMode(LPDWORD);
-WINBASEAPI COORD WINAPI  GetConsoleFontSize(HANDLE,DWORD);
+
+#ifdef __i386__
+/* Note: this should return a COORD, but calling convention for returning
+ * structures is different between Windows and gcc on i386. */
+WINBASEAPI DWORD WINAPI GetConsoleFontSize(HANDLE, DWORD);
+
+static inline COORD __wine_GetConsoleFontSize_wrapper(HANDLE h, DWORD d)
+{
+    union {
+      COORD c;
+      DWORD dw;
+    } u;
+    u.dw = GetConsoleFontSize(h, d);
+    return u.c;
+}
+#define GetConsoleFontSize(h, d) __wine_GetConsoleFontSize_wrapper(h, d)
+
+#else  /* __i386__ */
+WINBASEAPI COORD WINAPI GetConsoleFontSize(HANDLE, DWORD);
+#endif  /* __i386__ */
+
 WINBASEAPI BOOL WINAPI   GetConsoleHistoryInfo(LPCONSOLE_HISTORY_INFO);
 WINBASEAPI BOOL WINAPI   GetConsoleInputExeNameA(DWORD,LPSTR);
 WINBASEAPI BOOL WINAPI   GetConsoleInputExeNameW(DWORD,LPWSTR);
-- 
1.7.9.5



More information about the wine-patches mailing list