Commit a95d7f6c authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Recreate the process parameters structure once everything has been initialized.

parent 50f0ed75
...@@ -669,3 +669,44 @@ void init_user_process_params( SIZE_T data_size ) ...@@ -669,3 +669,44 @@ void init_user_process_params( SIZE_T data_size )
done: done:
RtlFreeHeap( GetProcessHeap(), 0, info ); RtlFreeHeap( GetProcessHeap(), 0, info );
} }
/***********************************************************************
* update_user_process_params
*
* Rebuild the RTL_USER_PROCESS_PARAMETERS structure once we have initialized all the fields.
*/
void update_user_process_params( const UNICODE_STRING *image )
{
RTL_USER_PROCESS_PARAMETERS *params, *cur_params = NtCurrentTeb()->Peb->ProcessParameters;
UNICODE_STRING title = cur_params->WindowTitle;
WCHAR *env = cur_params->Environment;
cur_params->Environment = NULL; /* avoid copying it */
if (!title.Buffer) title = *image;
if (RtlCreateProcessParametersEx( &params, image, &cur_params->DllPath, NULL,
&cur_params->CommandLine, NULL, &title, &cur_params->Desktop,
&cur_params->ShellInfo, &cur_params->RuntimeInfo,
PROCESS_PARAMS_FLAG_NORMALIZED ))
return;
params->DebugFlags = cur_params->DebugFlags;
params->ConsoleHandle = cur_params->ConsoleHandle;
params->ConsoleFlags = cur_params->ConsoleFlags;
params->hStdInput = cur_params->hStdInput;
params->hStdOutput = cur_params->hStdOutput;
params->hStdError = cur_params->hStdError;
params->dwX = cur_params->dwX;
params->dwY = cur_params->dwY;
params->dwXSize = cur_params->dwXSize;
params->dwYSize = cur_params->dwYSize;
params->dwXCountChars = cur_params->dwXCountChars;
params->dwYCountChars = cur_params->dwYCountChars;
params->dwFillAttribute = cur_params->dwFillAttribute;
params->dwFlags = cur_params->dwFlags;
params->wShowWindow = cur_params->wShowWindow;
params->Environment = env;
RtlFreeHeap( GetProcessHeap(), 0, cur_params );
NtCurrentTeb()->Peb->ProcessParameters = params;
}
...@@ -3398,9 +3398,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2, ...@@ -3398,9 +3398,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
} }
peb->LoaderLock = &loader_section; peb->LoaderLock = &loader_section;
peb->ProcessParameters->ImagePathName = wm->ldr.FullDllName; update_user_process_params( &wm->ldr.FullDllName );
if (!peb->ProcessParameters->WindowTitle.Buffer)
peb->ProcessParameters->WindowTitle = wm->ldr.FullDllName;
version_init( wm->ldr.FullDllName.Buffer ); version_init( wm->ldr.FullDllName.Buffer );
virtual_set_large_address_space(); virtual_set_large_address_space();
......
...@@ -81,6 +81,7 @@ extern void virtual_init_threading(void) DECLSPEC_HIDDEN; ...@@ -81,6 +81,7 @@ extern void virtual_init_threading(void) DECLSPEC_HIDDEN;
extern void fill_cpu_info(void) DECLSPEC_HIDDEN; extern void fill_cpu_info(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_user_process_params( SIZE_T data_size ) DECLSPEC_HIDDEN; extern void init_user_process_params( SIZE_T data_size ) DECLSPEC_HIDDEN;
extern void update_user_process_params( const UNICODE_STRING *image ) DECLSPEC_HIDDEN;
/* server support */ /* server support */
extern timeout_t server_start_time DECLSPEC_HIDDEN; extern timeout_t server_start_time DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment