From 3bf456bb4473aa9c186096b52444ea585e51236d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 25 Nov 2000 21:46:30 +0000 Subject: [PATCH] Fixed GetLargestConsoleWindowSize return type for Winelib apps. --- dlls/kernel/kernel32.spec | 2 +- include/wincon.h | 17 ++++++++++++++++- win32/console.c | 21 ++++++++++++++------- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/dlls/kernel/kernel32.spec b/dlls/kernel/kernel32.spec index 78a73ab5c56..6ea1c310d3e 100644 --- a/dlls/kernel/kernel32.spec +++ b/dlls/kernel/kernel32.spec @@ -357,7 +357,7 @@ debug_channels (comm debugstr dll int resource stress thunk toolhelp win32) 336 stdcall GetHandleInformation(long ptr) GetHandleInformation 337 stub GetLSCallbackTarget 338 stub GetLSCallbackTemplate -339 stdcall GetLargestConsoleWindowSize(long) WIN32_GetLargestConsoleWindowSize +339 stdcall GetLargestConsoleWindowSize(long) GetLargestConsoleWindowSize 340 stdcall GetLastError() GetLastError 341 stdcall GetLocalTime(ptr) GetLocalTime 342 stdcall GetLocaleInfoA(long long ptr long) GetLocaleInfoA diff --git a/include/wincon.h b/include/wincon.h index bd78a841ab3..19fcfc52ff3 100644 --- a/include/wincon.h +++ b/include/wincon.h @@ -137,7 +137,22 @@ typedef struct tagINPUT_RECORD #define MENU_EVENT 0x08 #define FOCUS_EVENT 0x10 -COORD WINAPI GetLargestConsoleWindowSize(HANDLE); +#ifdef __i386__ +/* Note: this should return a COORD, but calling convention for returning + * structures is different between Windows and gcc on i386. */ +DWORD WINAPI GetLargestConsoleWindowSize(HANDLE); + +inline static COORD __wine_GetLargestConsoleWindowSize_wrapper(HANDLE h) +{ + DWORD dw = GetLargestConsoleWindowSize(h); + return *(COORD *)&dw; +} +#define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h) + +#else /* __i386__ */ +COORD WINAPI GetLargestConsoleWindowSize(HANDLE); +#endif /* __i386__ */ + BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,COORD,LPDWORD); BOOL WINAPI ReadConsoleOutputCharacterW(HANDLE,LPWSTR,DWORD,COORD,LPDWORD); #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter) diff --git a/win32/console.c b/win32/console.c index fc828e189a3..3ac3ed3e16a 100644 --- a/win32/console.c +++ b/win32/console.c @@ -511,7 +511,20 @@ BOOL WINAPI SetConsoleActiveScreenBuffer( /*********************************************************************** * GetLargestConsoleWindowSize (KERNEL32.226) + * + * Note: this should return a COORD, but calling convention for returning + * structures is different between Windows and gcc on i386. */ +#ifdef __i386__ +#undef GetLargestConsoleWindowSize +DWORD WINAPI GetLargestConsoleWindowSize( HANDLE hConsoleOutput ) +{ + COORD c; + c.X = 80; + c.Y = 24; + return *(DWORD *)&c; +} +#else /* __i386__ */ COORD WINAPI GetLargestConsoleWindowSize( HANDLE hConsoleOutput ) { COORD c; @@ -519,13 +532,7 @@ COORD WINAPI GetLargestConsoleWindowSize( HANDLE hConsoleOutput ) c.Y = 24; return c; } - -/* gcc doesn't return structures the same way as dwords */ -DWORD WINAPI WIN32_GetLargestConsoleWindowSize( HANDLE hConsoleOutput ) -{ - COORD c = GetLargestConsoleWindowSize( hConsoleOutput ); - return *(DWORD *)&c; -} +#endif /* __i386__ */ /*********************************************************************** * FreeConsole (KERNEL32.267)