Jacek Caban : ntdll: Pass RTL_USER_PROCESS_PARAMETERS to get_initial_console.
Alexandre Julliard
julliard at winehq.org
Mon Sep 21 15:12:16 CDT 2020
Module: wine
Branch: master
Commit: 6bcc1b9225efe028319bbc64ce6b42a03e4d7ec7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6bcc1b9225efe028319bbc64ce6b42a03e4d7ec7
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Sep 21 17:07:00 2020 +0200
ntdll: Pass RTL_USER_PROCESS_PARAMETERS to get_initial_console.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/env.c | 3 +--
dlls/ntdll/unix/env.c | 12 ++++++------
dlls/ntdll/unix/unix_private.h | 2 +-
dlls/ntdll/unixlib.h | 5 ++---
include/wine/condrv.h | 1 +
5 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c
index 933792317d..bf3fedcac6 100644
--- a/dlls/ntdll/env.c
+++ b/dlls/ntdll/env.c
@@ -1254,8 +1254,7 @@ void init_user_process_params(void)
RtlFreeUnicodeString( &cmdline );
RtlReleasePath( load_path );
- unix_funcs->get_initial_console( ¶ms->ConsoleHandle, ¶ms->hStdInput,
- ¶ms->hStdOutput, ¶ms->hStdError );
+ unix_funcs->get_initial_console( params );
params->wShowWindow = 1; /* SW_SHOWNORMAL */
run_wineboot( ¶ms->Environment );
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index 350fe6e8e0..1684f5dcc9 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -55,6 +55,7 @@
#include "winternl.h"
#include "winbase.h"
#include "winnls.h"
+#include "wine/condrv.h"
#include "wine/debug.h"
#include "unix_private.h"
@@ -1151,13 +1152,12 @@ NTSTATUS CDECL get_dynamic_environment( WCHAR *env, SIZE_T *size )
*
* Return the initial console handles.
*/
-void CDECL get_initial_console( HANDLE *handle, HANDLE *std_in, HANDLE *std_out, HANDLE *std_err )
+void CDECL get_initial_console( RTL_USER_PROCESS_PARAMETERS *params )
{
- *handle = *std_in = *std_out = *std_err = 0;
- if (isatty(0) || isatty(1) || isatty(2)) *handle = (HANDLE)2; /* see kernel32/kernel_private.h */
- if (!isatty(0)) wine_server_fd_to_handle( 0, GENERIC_READ|SYNCHRONIZE, OBJ_INHERIT, std_in );
- if (!isatty(1)) wine_server_fd_to_handle( 1, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, std_out );
- if (!isatty(2)) wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, std_err );
+ 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 );
}
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 39edee09a0..37c1e2ac01 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -107,7 +107,7 @@ extern NTSTATUS CDECL get_initial_environment( WCHAR **wargv[], WCHAR *env, SIZE
extern NTSTATUS CDECL get_startup_info( startup_info_t *info, SIZE_T *total_size, SIZE_T *info_size ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL get_dynamic_environment( WCHAR *env, SIZE_T *size ) DECLSPEC_HIDDEN;
extern void CDECL get_initial_directory( UNICODE_STRING *dir ) DECLSPEC_HIDDEN;
-extern void CDECL get_initial_console( HANDLE *handle, HANDLE *std_in, HANDLE *std_out, HANDLE *std_err ) DECLSPEC_HIDDEN;
+extern void CDECL get_initial_console( RTL_USER_PROCESS_PARAMETERS *params ) DECLSPEC_HIDDEN;
extern USHORT * CDECL get_unix_codepage_data(void) DECLSPEC_HIDDEN;
extern void CDECL get_locales( WCHAR *sys, WCHAR *user ) DECLSPEC_HIDDEN;
extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h
index f5c57dde4d..7ed3148e4c 100644
--- a/dlls/ntdll/unixlib.h
+++ b/dlls/ntdll/unixlib.h
@@ -27,7 +27,7 @@
struct _DISPATCHER_CONTEXT;
/* increment this when you change the function table */
-#define NTDLL_UNIXLIB_VERSION 105
+#define NTDLL_UNIXLIB_VERSION 106
struct unix_funcs
{
@@ -72,8 +72,7 @@ struct unix_funcs
NTSTATUS (CDECL *get_initial_environment)( WCHAR **wargv[], WCHAR *env, SIZE_T *size );
NTSTATUS (CDECL *get_startup_info)( startup_info_t *info, SIZE_T *total_size, SIZE_T *info_size );
NTSTATUS (CDECL *get_dynamic_environment)( WCHAR *env, SIZE_T *size );
- void (CDECL *get_initial_console)( HANDLE *handle, HANDLE *std_in,
- HANDLE *std_out, HANDLE *std_err );
+ void (CDECL *get_initial_console)( RTL_USER_PROCESS_PARAMETERS *params );
void (CDECL *get_initial_directory)( UNICODE_STRING *dir );
USHORT * (CDECL *get_unix_codepage_data)(void);
void (CDECL *get_locales)( WCHAR *sys, WCHAR *user );
diff --git a/include/wine/condrv.h b/include/wine/condrv.h
index b82531280b..a5633998db 100644
--- a/include/wine/condrv.h
+++ b/include/wine/condrv.h
@@ -244,5 +244,6 @@ struct condrv_ctrl_event
/* Wine specific values for console inheritance (params->ConsoleHandle) */
#define CONSOLE_HANDLE_ALLOC ((HANDLE)1)
+#define CONSOLE_HANDLE_SHELL ((HANDLE)2)
#endif /* _INC_CONDRV */
More information about the wine-cvs
mailing list