From 4bb5d3ab3e6f18b03d447d589f2a429058354c48 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Mon, 25 Oct 2004 21:47:23 +0000 Subject: [PATCH] - fixed the way length of msvcrt runtime info is passed - always return a NULL runtime info buffer in child if parent's runtime info is NULL - fixed typo in startupinfo size --- dlls/kernel/environ.c | 10 +++++----- dlls/kernel/process.c | 3 ++- dlls/ntdll/env.c | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dlls/kernel/environ.c b/dlls/kernel/environ.c index 180fef29cc6..2a8ce09b388 100644 --- a/dlls/kernel/environ.c +++ b/dlls/kernel/environ.c @@ -439,13 +439,13 @@ void ENV_CopyStartupInformation(void) startup_infoW.dwFillAttribute = rupp->dwFillAttribute; startup_infoW.dwFlags = rupp->dwFlags; startup_infoW.wShowWindow = rupp->wShowWindow; - startup_infoW.cbReserved2 = rupp->RuntimeInfo.Length; - startup_infoW.lpReserved2 = (void*)rupp->RuntimeInfo.Buffer; + startup_infoW.cbReserved2 = rupp->RuntimeInfo.MaximumLength; + startup_infoW.lpReserved2 = rupp->RuntimeInfo.MaximumLength ? (void*)rupp->RuntimeInfo.Buffer : NULL; startup_infoW.hStdInput = rupp->hStdInput; startup_infoW.hStdOutput = rupp->hStdOutput; startup_infoW.hStdError = rupp->hStdError; - startup_infoA.cb = sizeof(startup_infoW); + startup_infoA.cb = sizeof(startup_infoA); startup_infoA.lpReserved = NULL; startup_infoA.lpDesktop = (rupp->Desktop.Length && RtlUnicodeStringToAnsiString( &ansi, &rupp->Desktop, TRUE) == STATUS_SUCCESS) ? @@ -462,8 +462,8 @@ void ENV_CopyStartupInformation(void) startup_infoA.dwFillAttribute = rupp->dwFillAttribute; startup_infoA.dwFlags = rupp->dwFlags; startup_infoA.wShowWindow = rupp->wShowWindow; - startup_infoA.cbReserved2 = rupp->RuntimeInfo.Length; - startup_infoA.lpReserved2 = (void*)rupp->RuntimeInfo.Buffer; + startup_infoA.cbReserved2 = rupp->RuntimeInfo.MaximumLength; + startup_infoA.lpReserved2 = rupp->RuntimeInfo.MaximumLength ? (void*)rupp->RuntimeInfo.Buffer : NULL; startup_infoA.hStdInput = rupp->hStdInput; startup_infoA.hStdOutput = rupp->hStdOutput; startup_infoA.hStdError = rupp->hStdError; diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c index 187d6bf43dd..440d56f9d02 100644 --- a/dlls/kernel/process.c +++ b/dlls/kernel/process.c @@ -1408,7 +1408,8 @@ static RTL_USER_PROCESS_PARAMETERS *create_user_params( LPCWSTR filename, LPCWST if (startup->lpTitle) RtlInitUnicodeString( &title, startup->lpTitle ); if (startup->lpReserved2 && startup->cbReserved2) { - runtime.Length = runtime.MaximumLength = startup->cbReserved2; + runtime.Length = 0; + runtime.MaximumLength = startup->cbReserved2; runtime.Buffer = (WCHAR*)startup->lpReserved2; } diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c index c8350197cda..baba647d6a7 100644 --- a/dlls/ntdll/env.c +++ b/dlls/ntdll/env.c @@ -418,6 +418,7 @@ NTSTATUS WINAPI RtlCreateProcessParameters( RTL_USER_PROCESS_PARAMETERS **result { static const WCHAR empty[] = {0}; static const UNICODE_STRING empty_str = { 0, sizeof(empty), (WCHAR *)empty }; + static const UNICODE_STRING null_str = { 0, 0, NULL }; const RTL_USER_PROCESS_PARAMETERS *cur_params; ULONG size, total_size; @@ -433,7 +434,7 @@ NTSTATUS WINAPI RtlCreateProcessParameters( RTL_USER_PROCESS_PARAMETERS **result if (!WindowTitle) WindowTitle = &empty_str; if (!Desktop) Desktop = &empty_str; if (!ShellInfo) ShellInfo = &empty_str; - if (!RuntimeInfo) RuntimeInfo = &empty_str; + if (!RuntimeInfo) RuntimeInfo = &null_str; size = (sizeof(RTL_USER_PROCESS_PARAMETERS) + ImagePathName->MaximumLength -- 2.11.4.GIT