From 85fe2a25a06f06da2b48d9316b082f7509987df1 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sat, 28 Nov 2015 12:45:16 +0000 Subject: [PATCH] [NTOS:PS] - Properly acquire process rundown - Reference job object when assigning a process to it - Don't assert when creating a child process whose parent is in a job Fixes crashes in kernel32_winetest:process svn path=/trunk/; revision=70177 --- reactos/ntoskrnl/ps/job.c | 4 ++-- reactos/ntoskrnl/ps/process.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/ps/job.c b/reactos/ntoskrnl/ps/job.c index 5cd3a8a32a9..d6f2ba8fc1c 100644 --- a/reactos/ntoskrnl/ps/job.c +++ b/reactos/ntoskrnl/ps/job.c @@ -166,8 +166,7 @@ NtAssignProcessToJobObject ( /* lock the process so we can safely assign the process. Note that in the meanwhile another thread could have assigned this process to a job! */ - ExAcquireRundownProtection(&Process->RundownProtect); - if(NT_SUCCESS(Status)) + if(ExAcquireRundownProtection(&Process->RundownProtect)) { if(Process->Job == NULL && PsGetProcessSessionId(Process) == Job->SessionId) { @@ -176,6 +175,7 @@ NtAssignProcessToJobObject ( the job object might require it to wait, which is a bad thing while holding the process lock! */ Process->Job = Job; + ObReferenceObject(Job); } else { diff --git a/reactos/ntoskrnl/ps/process.c b/reactos/ntoskrnl/ps/process.c index d3bff78c9a3..71823c4fb58 100644 --- a/reactos/ntoskrnl/ps/process.c +++ b/reactos/ntoskrnl/ps/process.c @@ -714,7 +714,6 @@ PspCreateProcess(OUT PHANDLE ProcessHandle, { /* FIXME: We need to insert this process */ DPRINT1("Jobs not yet supported\n"); - ASSERT(FALSE); } /* Create PEB only for User-Mode Processes */