Alexandre Julliard : ntdll: Recreate the process parameters structure once everything has been initialized.
Alexandre Julliard
julliard at winehq.org
Wed Feb 13 15:30:40 CST 2019
Module: wine
Branch: master
Commit: a95d7f6c4fc17d5bb3b83ef6c7e307b1ce06d554
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a95d7f6c4fc17d5bb3b83ef6c7e307b1ce06d554
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Feb 13 14:39:11 2019 +0100
ntdll: Recreate the process parameters structure once everything has been initialized.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/env.c | 41 +++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/loader.c | 4 +---
dlls/ntdll/ntdll_misc.h | 1 +
3 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c
index d2b40bd..367d083 100644
--- a/dlls/ntdll/env.c
+++ b/dlls/ntdll/env.c
@@ -669,3 +669,44 @@ void init_user_process_params( SIZE_T data_size )
done:
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( ¶ms, 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;
+}
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 56a6c2d..6becb44 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3398,9 +3398,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
}
peb->LoaderLock = &loader_section;
- peb->ProcessParameters->ImagePathName = wm->ldr.FullDllName;
- if (!peb->ProcessParameters->WindowTitle.Buffer)
- peb->ProcessParameters->WindowTitle = wm->ldr.FullDllName;
+ update_user_process_params( &wm->ldr.FullDllName );
version_init( wm->ldr.FullDllName.Buffer );
virtual_set_large_address_space();
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index bad7d96..5a93ede 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -81,6 +81,7 @@ extern void virtual_init_threading(void) DECLSPEC_HIDDEN;
extern void fill_cpu_info(void) 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 update_user_process_params( const UNICODE_STRING *image ) DECLSPEC_HIDDEN;
/* server support */
extern timeout_t server_start_time DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list