Jacek Caban : ntdll: Fill console size in get_initial_console.
Alexandre Julliard
julliard at winehq.org
Mon Sep 21 15:12:16 CDT 2020
Module: wine
Branch: master
Commit: 0957f9302ca40bd85e092ed335d3fd10ab9bf4da
URL: https://source.winehq.org/git/wine.git/?a=commit;h=0957f9302ca40bd85e092ed335d3fd10ab9bf4da
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Sep 21 17:07:15 2020 +0200
ntdll: Fill console size in get_initial_console.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/env.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index 1684f5dcc9..f4d9ef15fc 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -32,6 +32,7 @@
#include <fcntl.h>
#include <stdarg.h>
#include <sys/types.h>
+#include <sys/ioctl.h>
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
@@ -1154,10 +1155,23 @@ NTSTATUS CDECL get_dynamic_environment( WCHAR *env, SIZE_T *size )
*/
void CDECL get_initial_console( RTL_USER_PROCESS_PARAMETERS *params )
{
+ int output_fd = -1;
if (isatty(0) || isatty(1) || isatty(2)) params->ConsoleHandle = CONSOLE_HANDLE_SHELL;
if (!isatty(0)) wine_server_fd_to_handle( 0, GENERIC_READ|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdInput );
- if (!isatty(1)) wine_server_fd_to_handle( 1, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdOutput );
if (!isatty(2)) wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdError );
+ else output_fd = 2;
+ if (!isatty(1)) wine_server_fd_to_handle( 1, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdOutput );
+ else output_fd = 1;
+
+ if (output_fd != -1)
+ {
+ struct winsize size;
+ if (!ioctl( output_fd, TIOCGWINSZ, &size ))
+ {
+ params->dwXCountChars = size.ws_col;
+ params->dwYCountChars = size.ws_row;
+ }
+ }
}
More information about the wine-cvs
mailing list