ntdll: Pass RTL_USER_PROCESS_PARAMETERS to get_initial_console.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-09-21 17:07:00 +02:00 committed by Alexandre Julliard
parent ef57a8df8b
commit 6bcc1b9225
5 changed files with 11 additions and 12 deletions

View File

@ -1254,8 +1254,7 @@ void init_user_process_params(void)
RtlFreeUnicodeString( &cmdline ); RtlFreeUnicodeString( &cmdline );
RtlReleasePath( load_path ); RtlReleasePath( load_path );
unix_funcs->get_initial_console( &params->ConsoleHandle, &params->hStdInput, unix_funcs->get_initial_console( params );
&params->hStdOutput, &params->hStdError );
params->wShowWindow = 1; /* SW_SHOWNORMAL */ params->wShowWindow = 1; /* SW_SHOWNORMAL */
run_wineboot( &params->Environment ); run_wineboot( &params->Environment );

View File

@ -55,6 +55,7 @@
#include "winternl.h" #include "winternl.h"
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
#include "wine/condrv.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "unix_private.h" #include "unix_private.h"
@ -1151,13 +1152,12 @@ NTSTATUS CDECL get_dynamic_environment( WCHAR *env, SIZE_T *size )
* *
* Return the initial console handles. * 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)) params->ConsoleHandle = CONSOLE_HANDLE_SHELL;
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, &params->hStdInput );
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, &params->hStdOutput );
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, &params->hStdError );
if (!isatty(2)) wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, std_err );
} }

View File

@ -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_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 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_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 USHORT * CDECL get_unix_codepage_data(void) DECLSPEC_HIDDEN;
extern void CDECL get_locales( WCHAR *sys, WCHAR *user ) DECLSPEC_HIDDEN; extern void CDECL get_locales( WCHAR *sys, WCHAR *user ) DECLSPEC_HIDDEN;
extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN; extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN;

View File

@ -27,7 +27,7 @@
struct _DISPATCHER_CONTEXT; struct _DISPATCHER_CONTEXT;
/* increment this when you change the function table */ /* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 105 #define NTDLL_UNIXLIB_VERSION 106
struct unix_funcs 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_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_startup_info)( startup_info_t *info, SIZE_T *total_size, SIZE_T *info_size );
NTSTATUS (CDECL *get_dynamic_environment)( WCHAR *env, SIZE_T *size ); NTSTATUS (CDECL *get_dynamic_environment)( WCHAR *env, SIZE_T *size );
void (CDECL *get_initial_console)( HANDLE *handle, HANDLE *std_in, void (CDECL *get_initial_console)( RTL_USER_PROCESS_PARAMETERS *params );
HANDLE *std_out, HANDLE *std_err );
void (CDECL *get_initial_directory)( UNICODE_STRING *dir ); void (CDECL *get_initial_directory)( UNICODE_STRING *dir );
USHORT * (CDECL *get_unix_codepage_data)(void); USHORT * (CDECL *get_unix_codepage_data)(void);
void (CDECL *get_locales)( WCHAR *sys, WCHAR *user ); void (CDECL *get_locales)( WCHAR *sys, WCHAR *user );

View File

@ -244,5 +244,6 @@ struct condrv_ctrl_event
/* Wine specific values for console inheritance (params->ConsoleHandle) */ /* Wine specific values for console inheritance (params->ConsoleHandle) */
#define CONSOLE_HANDLE_ALLOC ((HANDLE)1) #define CONSOLE_HANDLE_ALLOC ((HANDLE)1)
#define CONSOLE_HANDLE_SHELL ((HANDLE)2)
#endif /* _INC_CONDRV */ #endif /* _INC_CONDRV */