From 21f9ca1b64ec39abf29f419005daf0a227b81da5 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Fri, 21 Jan 2005 14:40:06 +0000 Subject: [PATCH] implemented NtOpenJobObject() svn path=/trunk/; revision=13185 --- reactos/ntoskrnl/ps/job.c | 51 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/ps/job.c b/reactos/ntoskrnl/ps/job.c index 32ddfc797a7..963dd381d90 100644 --- a/reactos/ntoskrnl/ps/job.c +++ b/reactos/ntoskrnl/ps/job.c @@ -337,7 +337,7 @@ NtIsProcessInJob(IN HANDLE ProcessHandle, /* - * @unimplemented + * @implemented */ NTSTATUS STDCALL @@ -345,8 +345,53 @@ NtOpenJobObject(PHANDLE JobHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + KPROCESSOR_MODE PreviousMode; + HANDLE hJob; + NTSTATUS Status = STATUS_SUCCESS; + + PreviousMode = ExGetPreviousMode(); + + /* check for valid buffers */ + if(PreviousMode == UserMode) + { + _SEH_TRY + { + /* probe with 32bit alignment */ + ProbeForWrite(JobHandle, + sizeof(HANDLE), + sizeof(ULONG)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + + if(NT_SUCCESS(Status)) + { + Status = ObOpenObjectByName(ObjectAttributes, + PsJobType, + NULL, + PreviousMode, + DesiredAccess, + NULL, + &hJob); + if(NT_SUCCESS(Status)) + { + _SEH_TRY + { + *JobHandle = hJob; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + } + + return Status; }