kernel32: Implementation of GetLargestConsoleWindowSize.
Reijo Sund
reijo.sund at helsinki.fi
Thu May 1 02:20:19 CDT 2008
The function should return the largest size instead of hard coded
constants. A fix for the bug 10919.
---
dlls/kernel32/console.c | 94
+++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 94 insertions(+), 0 deletions(-)
diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index 21ce10a..0fb2540 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -1093,8 +1093,55 @@ DWORD WINAPI GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
COORD c;
DWORD w;
} x;
+ BOOL ret;
+ HANDLE hConOut;
+ HWND hWnd;
+ int col,lin,colpix,linpix,colext,linext,maxcolpix,maxlinpix;
+
+ hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
+ SERVER_START_REQ(get_console_output_info)
+ {
+ req->handle = console_handle_unmap(hConOut);
+ ret = !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;
+ ret = !wine_server_call_err(req);
+ colpix = reply->client.right - reply->client.left;
+ linpix = reply->client.bottom - reply->client.top;
+ colext = (reply->window.right - reply->window.left) - colpix;
+ linext = (reply->window.bottom - reply->window.top) - linpix;
+ }
+ SERVER_END_REQ;
+
+ SERVER_START_REQ( get_desktop_window )
+ {
+ req->force = 1;
+ ret = !wine_server_call(req);
+ hWnd = reply->handle;
+ }
+ SERVER_END_REQ;
+
+ SERVER_START_REQ( get_window_rectangles )
+ {
+ req->handle = hWnd;
+ ret = !wine_server_call_err(req);
+ maxcolpix = reply->window.right - reply->window.left - 2 * colext;
+ maxlinpix = reply->window.bottom - reply->window.top - 3 * linext;
+ }
+ SERVER_END_REQ;
+
x.c.X = 80;
x.c.Y = 24;
+ if (colpix > 0) x.c.X = maxcolpix*col/colpix;
+ if (linpix > 0) x.c.Y = maxlinpix*lin/linpix;
TRACE("(%p), returning %dx%d (%x)\n", hConsoleOutput, x.c.X, x.c.Y, x.w);
return x.w;
}
@@ -1114,8 +1161,55 @@ DWORD WINAPI GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
COORD WINAPI GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
{
COORD c;
+ BOOL ret;
+ HANDLE hConOut;
+ HWND hWnd;
+ int col,lin,colpix,linpix,colext,linext,maxcolpix,maxlinpix;
+
+ hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
+ SERVER_START_REQ(get_console_output_info)
+ {
+ req->handle = console_handle_unmap(hConOut);
+ ret = !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;
+ ret = !wine_server_call_err(req);
+ colpix = reply->client.right - reply->client.left;
+ linpix = reply->client.bottom - reply->client.top;
+ colext = (reply->window.right - reply->window.left) - colpix;
+ linext = (reply->window.bottom - reply->window.top) - linpix;
+ }
+ SERVER_END_REQ;
+
+ SERVER_START_REQ( get_desktop_window )
+ {
+ req->force = 1;
+ ret = !wine_server_call(req);
+ hWnd = reply->handle;
+ }
+ SERVER_END_REQ;
+
+ SERVER_START_REQ( get_window_rectangles )
+ {
+ req->handle = hWnd;
+ ret = !wine_server_call_err(req);
+ maxcolpix = reply->window.right - reply->window.left - 2 * colext;
+ maxlinpix = reply->window.bottom - reply->window.top - 3 * linext;
+ }
+ SERVER_END_REQ;
+
c.X = 80;
c.Y = 24;
+ if (colpix > 0) c.X = maxcolpix*col/colpix;
+ if (linpix > 0) c.Y = maxlinpix*lin/linpix;
TRACE("(%p), returning %dx%d\n", hConsoleOutput, c.X, c.Y);
return c;
}
--
1.5.4.3
More information about the wine-patches
mailing list