Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/ntdll/thread.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index c4e02dacb1..7ee6b92a15 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -67,7 +67,6 @@ struct startup_info
static PEB *peb; static PEB_LDR_DATA ldr; -static RTL_USER_PROCESS_PARAMETERS params; /* default parameters if no parent */ static WCHAR current_dir[MAX_PATH]; static RTL_BITMAP tls_bitmap; static RTL_BITMAP tls_expansion_bitmap; @@ -307,7 +306,6 @@ void thread_init(void) peb = addr;
peb->FastPebLock = &peb_lock; - peb->ProcessParameters = ¶ms; peb->TlsBitmap = &tls_bitmap; peb->TlsExpansionBitmap = &tls_expansion_bitmap; peb->FlsBitmap = &fls_bitmap; @@ -316,9 +314,6 @@ void thread_init(void) peb->OSMinorVersion = 1; peb->OSBuildNumber = 0xA28; peb->OSPlatformId = VER_PLATFORM_WIN32_NT; - params.CurrentDirectory.DosPath.Buffer = current_dir; - params.CurrentDirectory.DosPath.MaximumLength = sizeof(current_dir); - params.wShowWindow = 1; /* SW_SHOWNORMAL */ ldr.Length = sizeof(ldr); ldr.Initialized = TRUE; RtlInitializeBitMap( &tls_bitmap, peb->TlsBitmapBits, sizeof(peb->TlsBitmapBits) * 8 ); @@ -379,14 +374,25 @@ void thread_init(void) } else { + RTL_USER_PROCESS_PARAMETERS *params = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*params) ); + + params->AllocationSize = sizeof(*params); + params->Size = sizeof(*params); + params->Flags = PROCESS_PARAMS_FLAG_NORMALIZED; + params->CurrentDirectory.DosPath.Buffer = current_dir; + params->CurrentDirectory.DosPath.MaximumLength = sizeof(current_dir); + params->wShowWindow = 1; /* SW_SHOWNORMAL */ + if (isatty(0) || isatty(1) || isatty(2)) - params.ConsoleHandle = (HANDLE)2; /* see kernel32/kernel_private.h */ + params->ConsoleHandle = (HANDLE)2; /* see kernel32/kernel_private.h */ if (!isatty(0)) - wine_server_fd_to_handle( 0, GENERIC_READ|SYNCHRONIZE, OBJ_INHERIT, ¶ms.hStdInput ); + 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 ); + 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 ); + wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdError ); + + peb->ProcessParameters = params; }
/* initialize time values in user_shared_data */