ntdll: Move retrieving the startup info to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f1ff598e2a
commit
15c3eaafbb
|
@ -1247,16 +1247,16 @@ wait:
|
||||||
*
|
*
|
||||||
* Fill the initial RTL_USER_PROCESS_PARAMETERS structure from the server.
|
* Fill the initial RTL_USER_PROCESS_PARAMETERS structure from the server.
|
||||||
*/
|
*/
|
||||||
void init_user_process_params( SIZE_T data_size )
|
void init_user_process_params(void)
|
||||||
{
|
{
|
||||||
WCHAR *src, *load_path, *dummy;
|
WCHAR *src, *load_path, *dummy;
|
||||||
SIZE_T info_size, env_size;
|
SIZE_T info_size, env_size, data_size = 0;
|
||||||
NTSTATUS status;
|
|
||||||
startup_info_t *info = NULL;
|
startup_info_t *info = NULL;
|
||||||
RTL_USER_PROCESS_PARAMETERS *params = NULL;
|
RTL_USER_PROCESS_PARAMETERS *params = NULL;
|
||||||
UNICODE_STRING curdir, dllpath, imagepath, cmdline, title, desktop, shellinfo, runtime;
|
UNICODE_STRING curdir, dllpath, imagepath, cmdline, title, desktop, shellinfo, runtime;
|
||||||
WCHAR **wargv;
|
WCHAR **wargv;
|
||||||
|
|
||||||
|
unix_funcs->get_startup_info( NULL, &data_size, &info_size );
|
||||||
if (!data_size)
|
if (!data_size)
|
||||||
{
|
{
|
||||||
RTL_USER_PROCESS_PARAMETERS initial_params = {0};
|
RTL_USER_PROCESS_PARAMETERS initial_params = {0};
|
||||||
|
@ -1296,18 +1296,7 @@ void init_user_process_params( SIZE_T data_size )
|
||||||
|
|
||||||
if (!(info = RtlAllocateHeap( GetProcessHeap(), 0, data_size ))) return;
|
if (!(info = RtlAllocateHeap( GetProcessHeap(), 0, data_size ))) return;
|
||||||
|
|
||||||
SERVER_START_REQ( get_startup_info )
|
if (unix_funcs->get_startup_info( info, &data_size, &info_size )) goto done;
|
||||||
{
|
|
||||||
wine_server_set_reply( req, info, data_size );
|
|
||||||
if (!(status = wine_server_call( req )))
|
|
||||||
{
|
|
||||||
data_size = wine_server_reply_size( reply );
|
|
||||||
info_size = reply->info_size;
|
|
||||||
env_size = data_size - info_size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SERVER_END_REQ;
|
|
||||||
if (status) goto done;
|
|
||||||
|
|
||||||
src = (WCHAR *)(info + 1);
|
src = (WCHAR *)(info + 1);
|
||||||
get_unicode_string( &curdir, &src, info->curdir_len );
|
get_unicode_string( &curdir, &src, info->curdir_len );
|
||||||
|
@ -1344,6 +1333,7 @@ void init_user_process_params( SIZE_T data_size )
|
||||||
params->wShowWindow = info->show;
|
params->wShowWindow = info->show;
|
||||||
|
|
||||||
/* environment needs to be a separate memory block */
|
/* environment needs to be a separate memory block */
|
||||||
|
env_size = data_size - info_size;
|
||||||
if ((params->Environment = RtlAllocateHeap( GetProcessHeap(), 0, max( env_size, sizeof(WCHAR) ))))
|
if ((params->Environment = RtlAllocateHeap( GetProcessHeap(), 0, max( env_size, sizeof(WCHAR) ))))
|
||||||
{
|
{
|
||||||
if (env_size) memcpy( params->Environment, (char *)info + info_size, env_size );
|
if (env_size) memcpy( params->Environment, (char *)info + info_size, env_size );
|
||||||
|
|
|
@ -3960,7 +3960,7 @@ void __wine_process_init(void)
|
||||||
|
|
||||||
init_unix_codepage();
|
init_unix_codepage();
|
||||||
init_directories();
|
init_directories();
|
||||||
init_user_process_params( info_size );
|
init_user_process_params();
|
||||||
params = peb->ProcessParameters;
|
params = peb->ProcessParameters;
|
||||||
|
|
||||||
load_global_options();
|
load_global_options();
|
||||||
|
@ -4000,7 +4000,7 @@ void __wine_process_init(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!info_size) status = restart_process( params, status );
|
status = restart_process( params, status );
|
||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
case STATUS_INVALID_IMAGE_WIN_64:
|
case STATUS_INVALID_IMAGE_WIN_64:
|
||||||
|
|
|
@ -69,7 +69,7 @@ extern void actctx_init(void) DECLSPEC_HIDDEN;
|
||||||
extern void heap_set_debug_flags( HANDLE handle ) DECLSPEC_HIDDEN;
|
extern void heap_set_debug_flags( HANDLE handle ) DECLSPEC_HIDDEN;
|
||||||
extern void init_unix_codepage(void) DECLSPEC_HIDDEN;
|
extern void init_unix_codepage(void) DECLSPEC_HIDDEN;
|
||||||
extern void init_locale( HMODULE module ) DECLSPEC_HIDDEN;
|
extern void init_locale( HMODULE module ) DECLSPEC_HIDDEN;
|
||||||
extern void init_user_process_params( SIZE_T data_size ) DECLSPEC_HIDDEN;
|
extern void init_user_process_params(void) DECLSPEC_HIDDEN;
|
||||||
extern NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status ) DECLSPEC_HIDDEN;
|
extern NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* server support */
|
/* server support */
|
||||||
|
|
|
@ -66,6 +66,7 @@ extern char **__wine_main_environ;
|
||||||
extern WCHAR **__wine_main_wargv;
|
extern WCHAR **__wine_main_wargv;
|
||||||
|
|
||||||
USHORT *uctable = NULL, *lctable = NULL;
|
USHORT *uctable = NULL, *lctable = NULL;
|
||||||
|
SIZE_T startup_info_size = 0;
|
||||||
|
|
||||||
int main_argc = 0;
|
int main_argc = 0;
|
||||||
char **main_argv = NULL;
|
char **main_argv = NULL;
|
||||||
|
@ -903,6 +904,32 @@ static void add_path_var( WCHAR *env, SIZE_T *pos, const char *name, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* get_startup_info
|
||||||
|
*
|
||||||
|
* Get the startup information from the server.
|
||||||
|
*/
|
||||||
|
NTSTATUS CDECL get_startup_info( startup_info_t *info, SIZE_T *total_size, SIZE_T *info_size )
|
||||||
|
{
|
||||||
|
NTSTATUS status;
|
||||||
|
|
||||||
|
if (*total_size < startup_info_size)
|
||||||
|
{
|
||||||
|
*total_size = startup_info_size;
|
||||||
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
SERVER_START_REQ( get_startup_info )
|
||||||
|
{
|
||||||
|
wine_server_set_reply( req, info, *total_size );
|
||||||
|
status = wine_server_call( req );
|
||||||
|
*total_size = wine_server_reply_size( reply );
|
||||||
|
*info_size = reply->info_size;
|
||||||
|
}
|
||||||
|
SERVER_END_REQ;
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* get_dynamic_environment
|
* get_dynamic_environment
|
||||||
*
|
*
|
||||||
|
|
|
@ -1497,6 +1497,7 @@ static struct unix_funcs unix_funcs =
|
||||||
ntdll_sqrt,
|
ntdll_sqrt,
|
||||||
ntdll_tan,
|
ntdll_tan,
|
||||||
get_initial_environment,
|
get_initial_environment,
|
||||||
|
get_startup_info,
|
||||||
get_dynamic_environment,
|
get_dynamic_environment,
|
||||||
get_initial_console,
|
get_initial_console,
|
||||||
get_initial_directory,
|
get_initial_directory,
|
||||||
|
|
|
@ -591,6 +591,8 @@ NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTST
|
||||||
char **argv;
|
char **argv;
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
|
|
||||||
|
if (startup_info_size) return status; /* started from another Win32 process */
|
||||||
|
|
||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
case STATUS_CONFLICTING_ADDRESSES:
|
case STATUS_CONFLICTING_ADDRESSES:
|
||||||
|
|
|
@ -90,7 +90,6 @@ TEB * CDECL init_threading( SIZE_T *size )
|
||||||
{
|
{
|
||||||
TEB *teb;
|
TEB *teb;
|
||||||
BOOL suspend;
|
BOOL suspend;
|
||||||
SIZE_T info_size;
|
|
||||||
|
|
||||||
teb = virtual_alloc_first_teb();
|
teb = virtual_alloc_first_teb();
|
||||||
|
|
||||||
|
@ -99,14 +98,14 @@ TEB * CDECL init_threading( SIZE_T *size )
|
||||||
signal_init_thread( teb );
|
signal_init_thread( teb );
|
||||||
dbg_init();
|
dbg_init();
|
||||||
server_init_process();
|
server_init_process();
|
||||||
info_size = server_init_thread( teb->Peb, &suspend );
|
startup_info_size = server_init_thread( teb->Peb, &suspend );
|
||||||
virtual_map_user_shared_data();
|
virtual_map_user_shared_data();
|
||||||
virtual_create_builtin_view( ntdll_module );
|
virtual_create_builtin_view( ntdll_module );
|
||||||
init_cpu_info();
|
init_cpu_info();
|
||||||
init_files();
|
init_files();
|
||||||
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
|
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
|
||||||
|
|
||||||
if (size) *size = info_size;
|
if (size) *size = startup_info_size;
|
||||||
return teb;
|
return teb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,7 @@ int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
|
||||||
int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), void *arg,
|
int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), void *arg,
|
||||||
int top_down ) DECLSPEC_HIDDEN;
|
int top_down ) DECLSPEC_HIDDEN;
|
||||||
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_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( HANDLE *handle, HANDLE *std_in, HANDLE *std_out, HANDLE *std_err ) DECLSPEC_HIDDEN;
|
||||||
|
@ -137,6 +138,7 @@ extern const char **dll_paths DECLSPEC_HIDDEN;
|
||||||
extern HMODULE ntdll_module DECLSPEC_HIDDEN;
|
extern HMODULE ntdll_module DECLSPEC_HIDDEN;
|
||||||
extern USHORT *uctable DECLSPEC_HIDDEN;
|
extern USHORT *uctable DECLSPEC_HIDDEN;
|
||||||
extern USHORT *lctable DECLSPEC_HIDDEN;
|
extern USHORT *lctable DECLSPEC_HIDDEN;
|
||||||
|
extern SIZE_T startup_info_size DECLSPEC_HIDDEN;
|
||||||
extern int main_argc DECLSPEC_HIDDEN;
|
extern int main_argc DECLSPEC_HIDDEN;
|
||||||
extern char **main_argv DECLSPEC_HIDDEN;
|
extern char **main_argv DECLSPEC_HIDDEN;
|
||||||
extern char **main_envp DECLSPEC_HIDDEN;
|
extern char **main_envp DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -28,7 +28,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 67
|
#define NTDLL_UNIXLIB_VERSION 68
|
||||||
|
|
||||||
struct unix_funcs
|
struct unix_funcs
|
||||||
{
|
{
|
||||||
|
@ -298,6 +298,7 @@ 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_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)( HANDLE *handle, HANDLE *std_in,
|
||||||
HANDLE *std_out, HANDLE *std_err );
|
HANDLE *std_out, HANDLE *std_err );
|
||||||
|
|
Loading…
Reference in New Issue