From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/ntdll/unix/env.c | 11 +++++------ dlls/ntdll/unix/loader.c | 5 +++-- dlls/ntdll/unix/unix_private.h | 3 +-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 0fb7c59e9d9..92fbc2dc7d5 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -67,7 +67,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(environ); PEB *peb = NULL; WOW_PEB *wow_peb = NULL; USHORT *uctable = NULL, *lctable = NULL; -SIZE_T startup_info_size = 0; BOOL is_prefix_bootstrap = FALSE; static const WCHAR bootstrapW[] = {'W','I','N','E','B','O','O','T','S','T','R','A','P','M','O','D','E'}; @@ -1998,29 +1997,29 @@ static RTL_USER_PROCESS_PARAMETERS *build_initial_params( void **module ) /************************************************************************* * init_startup_info */ -void init_startup_info(void) +void init_startup_info( SIZE_T info_size ) { WCHAR *src, *dst, *env; void *module = NULL; unsigned int status; - SIZE_T size, info_size, env_size, env_pos; + SIZE_T size, env_size, env_pos; RTL_USER_PROCESS_PARAMETERS *params = NULL; struct startup_info_data *info; UNICODE_STRING nt_name; USHORT machine; - if (!startup_info_size) + if (!info_size) { params = build_initial_params( &module ); init_peb( params, module ); return; } - info = malloc( startup_info_size ); + info = malloc( info_size ); SERVER_START_REQ( get_startup_info ) { - wine_server_set_reply( req, info, startup_info_size ); + wine_server_set_reply( req, info, info_size ); status = wine_server_call( req ); machine = reply->machine; info_size = reply->info_size; diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 28fc09cd354..20b050c3999 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1857,14 +1857,15 @@ static ULONG_PTR get_image_address(void) static void start_main_thread(void) { TEB *teb = virtual_alloc_first_teb(); + SIZE_T info_size; signal_init_threading(); dbg_init(); - startup_info_size = server_init_process(); + info_size = server_init_process(); virtual_map_user_shared_data(); init_cpu_info(); init_files(); - init_startup_info(); + init_startup_info( info_size ); *(ULONG_PTR *)&peb->CloudFileFlags = get_image_address(); set_load_order_app_name( main_wargv[0] ); init_thread_stack( teb, 0, 0, 0 ); diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 10f6bb2c63c..c547b334fa5 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -188,7 +188,6 @@ extern pthread_key_t teb_key; extern PEB *peb; extern USHORT *uctable; extern USHORT *lctable; -extern SIZE_T startup_info_size; extern BOOL is_prefix_bootstrap; extern int main_argc; extern char **main_argv; @@ -206,7 +205,7 @@ extern struct _KUSER_SHARED_DATA *user_shared_data; extern ULONG process_cookie; extern void init_environment(void); -extern void init_startup_info(void); +extern void init_startup_info( SIZE_T info_size ); extern void *create_startup_info( const UNICODE_STRING *nt_image, ULONG process_flags, const RTL_USER_PROCESS_PARAMETERS *params, const struct pe_image_info *pe_info, DWORD *info_size ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10058