ntdll: Move the console handle initialization to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ed566a8723
commit
b9f531a0e8
|
@ -1286,14 +1286,8 @@ void init_user_process_params( SIZE_T data_size )
|
||||||
RtlFreeUnicodeString( &cmdline );
|
RtlFreeUnicodeString( &cmdline );
|
||||||
RtlReleasePath( load_path );
|
RtlReleasePath( load_path );
|
||||||
|
|
||||||
if (isatty(0) || isatty(1) || isatty(2))
|
unix_funcs->get_initial_console( ¶ms->ConsoleHandle, ¶ms->hStdInput,
|
||||||
params->ConsoleHandle = (HANDLE)2; /* see kernel32/kernel_private.h */
|
¶ms->hStdOutput, ¶ms->hStdError );
|
||||||
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 );
|
|
||||||
params->wShowWindow = 1; /* SW_SHOWNORMAL */
|
params->wShowWindow = 1; /* SW_SHOWNORMAL */
|
||||||
|
|
||||||
run_wineboot( ¶ms->Environment );
|
run_wineboot( ¶ms->Environment );
|
||||||
|
|
|
@ -954,6 +954,21 @@ NTSTATUS CDECL get_dynamic_environment( WCHAR *env, SIZE_T *size )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* get_initial_console
|
||||||
|
*
|
||||||
|
* Return the initial console handles.
|
||||||
|
*/
|
||||||
|
void CDECL get_initial_console( HANDLE *handle, HANDLE *std_in, HANDLE *std_out, HANDLE *std_err )
|
||||||
|
{
|
||||||
|
*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)) server_fd_to_handle( 0, GENERIC_READ|SYNCHRONIZE, OBJ_INHERIT, std_in );
|
||||||
|
if (!isatty(1)) server_fd_to_handle( 1, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, std_out );
|
||||||
|
if (!isatty(2)) server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, std_err );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* get_initial_directory
|
* get_initial_directory
|
||||||
*
|
*
|
||||||
|
|
|
@ -1491,6 +1491,7 @@ static struct unix_funcs unix_funcs =
|
||||||
ntdll_tan,
|
ntdll_tan,
|
||||||
get_initial_environment,
|
get_initial_environment,
|
||||||
get_dynamic_environment,
|
get_dynamic_environment,
|
||||||
|
get_initial_console,
|
||||||
get_initial_directory,
|
get_initial_directory,
|
||||||
get_unix_codepage,
|
get_unix_codepage,
|
||||||
get_locales,
|
get_locales,
|
||||||
|
|
|
@ -99,6 +99,7 @@ int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T s
|
||||||
extern NTSTATUS CDECL get_initial_environment( WCHAR **wargv[], WCHAR *env, SIZE_T *size ) DECLSPEC_HIDDEN;
|
extern NTSTATUS CDECL get_initial_environment( WCHAR **wargv[], WCHAR *env, SIZE_T *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_unix_codepage( CPTABLEINFO *table ) DECLSPEC_HIDDEN;
|
extern void CDECL get_unix_codepage( CPTABLEINFO *table ) 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 NTSTATUS CDECL virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsigned short zero_bits_64, SIZE_T commit_size,
|
extern NTSTATUS CDECL virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsigned short zero_bits_64, SIZE_T commit_size,
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct msghdr;
|
||||||
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 64
|
#define NTDLL_UNIXLIB_VERSION 65
|
||||||
|
|
||||||
struct unix_funcs
|
struct unix_funcs
|
||||||
{
|
{
|
||||||
|
@ -300,6 +300,8 @@ struct unix_funcs
|
||||||
/* environment functions */
|
/* environment functions */
|
||||||
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_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,
|
||||||
|
HANDLE *std_out, HANDLE *std_err );
|
||||||
void (CDECL *get_initial_directory)( UNICODE_STRING *dir );
|
void (CDECL *get_initial_directory)( UNICODE_STRING *dir );
|
||||||
void (CDECL *get_unix_codepage)( CPTABLEINFO *table );
|
void (CDECL *get_unix_codepage)( CPTABLEINFO *table );
|
||||||
void (CDECL *get_locales)( WCHAR *sys, WCHAR *user );
|
void (CDECL *get_locales)( WCHAR *sys, WCHAR *user );
|
||||||
|
|
Loading…
Reference in New Issue