partial implementation of NtTerminateJobObject()
Modified: trunk/reactos/ntoskrnl/ps/job.c

Modified: trunk/reactos/ntoskrnl/ps/job.c
--- trunk/reactos/ntoskrnl/ps/job.c	2005-01-21 14:40:06 UTC (rev 13185)
+++ trunk/reactos/ntoskrnl/ps/job.c	2005-01-21 14:52:53 UTC (rev 13186)
@@ -90,7 +90,16 @@
   return STATUS_NOT_IMPLEMENTED;
 }
 
+NTSTATUS
+PspTerminateJobObject(PEJOB Job,
+                      KPROCESSOR_MODE AccessMode,
+                      NTSTATUS ExitStatus)
+{
+  DPRINT("PspTerminateJobObject() is unimplemented!\n");
+  return STATUS_NOT_IMPLEMENTED;
+}
 
+
 /*
  * @unimplemented
  */
@@ -434,8 +443,27 @@
 NtTerminateJobObject(HANDLE JobHandle,
                      NTSTATUS ExitStatus)
 {
-  UNIMPLEMENTED;
-  return STATUS_NOT_IMPLEMENTED;
+  KPROCESSOR_MODE PreviousMode;
+  PEJOB Job;
+  NTSTATUS Status;
+  
+  PreviousMode = ExGetPreviousMode();
+  
+  Status = ObReferenceObjectByHandle(JobHandle,
+                                     JOB_OBJECT_TERMINATE,
+                                     PsJobType,
+                                     PreviousMode,
+                                     (PVOID*)&Job,
+                                     NULL);
+  if(NT_SUCCESS(Status))
+  {
+    Status = PspTerminateJobObject(Job,
+                                   PreviousMode,
+                                   ExitStatus);
+    ObDereferenceObject(Job);
+  }
+  
+  return Status;
 }