mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-02 15:28:03 +00:00
ntdll: Allocate process parameters on the heap in RtlCreateProcessParametersEx().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
179c0ee6fb
commit
b5d4484cd2
1 changed files with 7 additions and 10 deletions
|
@ -460,10 +460,10 @@ NTSTATUS WINAPI RtlCreateProcessParametersEx( RTL_USER_PROCESS_PARAMETERS **resu
|
||||||
|
|
||||||
UNICODE_STRING curdir;
|
UNICODE_STRING curdir;
|
||||||
const RTL_USER_PROCESS_PARAMETERS *cur_params;
|
const RTL_USER_PROCESS_PARAMETERS *cur_params;
|
||||||
SIZE_T size, env_size, total_size;
|
SIZE_T size, env_size;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
const WCHAR *env;
|
const WCHAR *env;
|
||||||
NTSTATUS status;
|
NTSTATUS status = STATUS_SUCCESS;
|
||||||
|
|
||||||
RtlAcquirePebLock();
|
RtlAcquirePebLock();
|
||||||
cur_params = NtCurrentTeb()->Peb->ProcessParameters;
|
cur_params = NtCurrentTeb()->Peb->ProcessParameters;
|
||||||
|
@ -500,13 +500,10 @@ NTSTATUS WINAPI RtlCreateProcessParametersEx( RTL_USER_PROCESS_PARAMETERS **resu
|
||||||
+ ROUND_SIZE( ShellInfo->MaximumLength )
|
+ ROUND_SIZE( ShellInfo->MaximumLength )
|
||||||
+ ROUND_SIZE( RuntimeInfo->MaximumLength ));
|
+ ROUND_SIZE( RuntimeInfo->MaximumLength ));
|
||||||
|
|
||||||
total_size = size + env_size;
|
if ((ptr = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, size + env_size )))
|
||||||
ptr = NULL;
|
|
||||||
if ((status = NtAllocateVirtualMemory( NtCurrentProcess(), &ptr, 0, &total_size,
|
|
||||||
MEM_COMMIT, PAGE_READWRITE )) == STATUS_SUCCESS)
|
|
||||||
{
|
{
|
||||||
RTL_USER_PROCESS_PARAMETERS *params = ptr;
|
RTL_USER_PROCESS_PARAMETERS *params = ptr;
|
||||||
params->AllocationSize = total_size;
|
params->AllocationSize = size;
|
||||||
params->Size = size;
|
params->Size = size;
|
||||||
params->Flags = PROCESS_PARAMS_FLAG_NORMALIZED;
|
params->Flags = PROCESS_PARAMS_FLAG_NORMALIZED;
|
||||||
params->ConsoleFlags = cur_params->ConsoleFlags;
|
params->ConsoleFlags = cur_params->ConsoleFlags;
|
||||||
|
@ -526,6 +523,8 @@ NTSTATUS WINAPI RtlCreateProcessParametersEx( RTL_USER_PROCESS_PARAMETERS **resu
|
||||||
*result = params;
|
*result = params;
|
||||||
if (!(flags & PROCESS_PARAMS_FLAG_NORMALIZED)) RtlDeNormalizeProcessParams( params );
|
if (!(flags & PROCESS_PARAMS_FLAG_NORMALIZED)) RtlDeNormalizeProcessParams( params );
|
||||||
}
|
}
|
||||||
|
else status = STATUS_NO_MEMORY;
|
||||||
|
|
||||||
RtlReleasePebLock();
|
RtlReleasePebLock();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -555,7 +554,5 @@ NTSTATUS WINAPI RtlCreateProcessParameters( RTL_USER_PROCESS_PARAMETERS **result
|
||||||
*/
|
*/
|
||||||
void WINAPI RtlDestroyProcessParameters( RTL_USER_PROCESS_PARAMETERS *params )
|
void WINAPI RtlDestroyProcessParameters( RTL_USER_PROCESS_PARAMETERS *params )
|
||||||
{
|
{
|
||||||
void *ptr = params;
|
RtlFreeHeap( GetProcessHeap(), 0, params );
|
||||||
SIZE_T size = 0;
|
|
||||||
NtFreeVirtualMemory( NtCurrentProcess(), &ptr, &size, MEM_RELEASE );
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue