Commit ae7ccbba authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Fixup size of the current directory in RtlCreateProcessParametersEx().

parent fce198cc
......@@ -452,6 +452,7 @@ NTSTATUS WINAPI RtlCreateProcessParametersEx( RTL_USER_PROCESS_PARAMETERS **resu
static const UNICODE_STRING empty_str = { 0, sizeof(empty), empty };
static const UNICODE_STRING null_str = { 0, 0, NULL };
UNICODE_STRING curdir;
const RTL_USER_PROCESS_PARAMETERS *cur_params;
SIZE_T size, env_size, total_size;
void *ptr;
......@@ -464,10 +465,13 @@ NTSTATUS WINAPI RtlCreateProcessParametersEx( RTL_USER_PROCESS_PARAMETERS **resu
if (!CurrentDirectoryName)
{
if (NtCurrentTeb()->Tib.SubSystemTib) /* FIXME: hack */
CurrentDirectoryName = &((WIN16_SUBSYSTEM_TIB *)NtCurrentTeb()->Tib.SubSystemTib)->curdir.DosPath;
curdir = ((WIN16_SUBSYSTEM_TIB *)NtCurrentTeb()->Tib.SubSystemTib)->curdir.DosPath;
else
CurrentDirectoryName = &cur_params->CurrentDirectory.DosPath;
curdir = cur_params->CurrentDirectory.DosPath;
}
else curdir = *CurrentDirectoryName;
curdir.MaximumLength = MAX_PATH * sizeof(WCHAR);
if (!CommandLine) CommandLine = ImagePathName;
if (!Environment) Environment = cur_params->Environment;
if (!WindowTitle) WindowTitle = &empty_str;
......@@ -503,7 +507,7 @@ NTSTATUS WINAPI RtlCreateProcessParametersEx( RTL_USER_PROCESS_PARAMETERS **resu
/* all other fields are zero */
ptr = params + 1;
append_unicode_string( &ptr, CurrentDirectoryName, &params->CurrentDirectory.DosPath );
append_unicode_string( &ptr, &curdir, &params->CurrentDirectory.DosPath );
append_unicode_string( &ptr, DllPath, &params->DllPath );
append_unicode_string( &ptr, ImagePathName, &params->ImagePathName );
append_unicode_string( &ptr, CommandLine, &params->CommandLine );
......
......@@ -68,7 +68,7 @@ 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_NT_PATH_LENGTH];
static WCHAR current_dir[MAX_PATH];
static RTL_BITMAP tls_bitmap;
static RTL_BITMAP tls_expansion_bitmap;
static RTL_BITMAP fls_bitmap;
......@@ -130,7 +130,7 @@ static NTSTATUS init_user_process_params( SIZE_T data_size )
if (status != STATUS_SUCCESS) goto done;
size = sizeof(*params);
size += MAX_NT_PATH_LENGTH * sizeof(WCHAR);
size += sizeof(current_dir);
size += info->dllpath_len + sizeof(WCHAR);
size += info->imagepath_len + sizeof(WCHAR);
size += info->cmdline_len + sizeof(WCHAR);
......@@ -169,8 +169,8 @@ static NTSTATUS init_user_process_params( SIZE_T data_size )
/* current directory needs more space */
get_unicode_string( &params->CurrentDirectory.DosPath, &src, &dst, info->curdir_len );
params->CurrentDirectory.DosPath.MaximumLength = MAX_NT_PATH_LENGTH * sizeof(WCHAR);
dst = (WCHAR *)(params + 1) + MAX_NT_PATH_LENGTH;
params->CurrentDirectory.DosPath.MaximumLength = sizeof(current_dir);
dst = (WCHAR *)(params + 1) + ARRAY_SIZE(current_dir);
get_unicode_string( &params->DllPath, &src, &dst, info->dllpath_len );
get_unicode_string( &params->ImagePathName, &src, &dst, info->imagepath_len );
......
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