I know this breaks Windows behavior but having apps print out special debug messages to the terminal provides a good look into the applications' development (for example I know that NFS Underground has some "done" messages likely used for debugging).
I also don't want to keep another revert in my Wine tree just for this one feature either so that's why I'm MR'ing this.
I considered adding a registry/winecfg entry for this behavior but it would make this change much larger (and there's no good place in winecfg to put this behavior in).
To enable this behavior, you can set WINEDEBUG=+unixcon variable before launching an application.
Xkcd-Entry: https://xkcd.com/1172/ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55435
-- v3: ntdll/unix: Add an option to inherit the Unix console handle.
From: Aida Jonikienė aidas957@gmail.com
I know this breaks Windows behavior but having apps print out special debug messages to the terminal provides a good look into the applications' development (for example I know that NFS Underground has some "done" messages likely used for debugging).
I also don't want to keep another revert in my Wine tree just for this one feature either so that's why I'm MR'ing this.
I considered adding a registry/winecfg entry for this behavior but it would make this change much larger (and there's no good place in winecfg to put this behavior in).
To enable this behavior, you can set WINEDEBUG=+unixcon variable before launching an application.
Xkcd-Entry: https://xkcd.com/1172/ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55435 --- dlls/ntdll/unix/env.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index ad9ab0dc220..843ae05932b 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -59,6 +59,7 @@ #include "error.h"
WINE_DEFAULT_DEBUG_CHANNEL(environ); +WINE_DECLARE_DEBUG_CHANNEL(unixcon);
PEB *peb = NULL; WOW_PEB *wow_peb = NULL; @@ -2183,16 +2184,20 @@ void *create_startup_info( const UNICODE_STRING *nt_image, ULONG process_flags,
info->debug_flags = params->DebugFlags; info->console_flags = params->ConsoleFlags; - if (pe_info->subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) + if (pe_info->subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI || TRACE_ON( unixcon )) info->console = wine_server_obj_handle( params->ConsoleHandle ); if ((process_flags & PROCESS_CREATE_FLAGS_INHERIT_HANDLES) || - (pe_info->subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI && !(params->dwFlags & STARTF_USESTDHANDLES))) + (pe_info->subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI && !(params->dwFlags & STARTF_USESTDHANDLES)) + || TRACE_ON( unixcon )) { - if (pe_info->subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI || !is_console_handle( params->hStdInput )) + if (pe_info->subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI || !is_console_handle( params->hStdInput ) + || TRACE_ON( unixcon )) info->hstdin = wine_server_obj_handle( params->hStdInput ); - if (pe_info->subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI || !is_console_handle( params->hStdOutput )) + if (pe_info->subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI || !is_console_handle( params->hStdOutput ) + || TRACE_ON( unixcon )) info->hstdout = wine_server_obj_handle( params->hStdOutput ); - if (pe_info->subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI || !is_console_handle( params->hStdError )) + if (pe_info->subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI || !is_console_handle( params->hStdError ) + || TRACE_ON( unixcon )) info->hstderr = wine_server_obj_handle( params->hStdError ); } info->x = params->dwX;
On Fri Dec 8 06:54:12 2023 +0000, eric pouech wrote:
It's unlikely this MR will make it into Wine. You should be able to get your GUI app output on unix console by using from your Unix shell
./wine <app> | cat
This feels like a less elegant solution to me :frog:
Recent Eric's changes required me to add the TRACE_ON stuff to extra `if` statements (but console output works again in GTA San Andreas and NFS Underground)