[CMAKE]
[reactos.git] / ntoskrnl / ps / job.c
index 135822d..7bded05 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <ntoskrnl.h>
 #define NDEBUG
-#include <internal/debug.h>
+#include <debug.h>
 
 
 /* GLOBALS *******************************************************************/
@@ -72,6 +72,7 @@ PspDeleteJob ( PVOID ObjectBody )
 
 VOID
 NTAPI
+INIT_FUNCTION
 PspInitializeJobStructures(VOID)
 {
     InitializeListHead(&PsJobListHead);
@@ -117,7 +118,7 @@ PspExitProcessFromJob(IN PEJOB Job,
  * @unimplemented
  */
 NTSTATUS
-STDCALL
+NTAPI
 NtAssignProcessToJobObject (
     HANDLE JobHandle,
     HANDLE ProcessHandle)
@@ -216,7 +217,7 @@ NtCreateJobSet(IN ULONG NumJob,
  * @unimplemented
  */
 NTSTATUS
-STDCALL
+NTAPI
 NtCreateJobObject (
     PHANDLE JobHandle,
     ACCESS_MASK DesiredAccess,
@@ -226,7 +227,7 @@ NtCreateJobObject (
     PEJOB Job;
     KPROCESSOR_MODE PreviousMode;
     PEPROCESS CurrentProcess;
-    NTSTATUS Status = STATUS_SUCCESS;
+    NTSTATUS Status;
 
     PAGED_CODE();
 
@@ -234,22 +235,17 @@ NtCreateJobObject (
     CurrentProcess = PsGetCurrentProcess();
 
     /* check for valid buffers */
-    if(PreviousMode != KernelMode)
+    if (PreviousMode != KernelMode)
     {
-        _SEH_TRY
+        _SEH2_TRY
         {
             ProbeForWriteHandle(JobHandle);
         }
-        _SEH_HANDLE
-        {
-            Status = _SEH_GetExceptionCode();
-        }
-        _SEH_END;
-
-        if(!NT_SUCCESS(Status))
+        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
         {
-            return Status;
+            _SEH2_YIELD(return _SEH2_GetExceptionCode());
         }
+        _SEH2_END;
     }
 
     Status = ObCreateObject(PreviousMode,
@@ -298,18 +294,18 @@ NtCreateJobObject (
         if(NT_SUCCESS(Status))
         {
             /* pass the handle back to the caller */
-            _SEH_TRY
+            _SEH2_TRY
             {
                 /* NOTE: if the caller passed invalid buffers to receive the handle it's his
                 own fault! the object will still be created and live... It's possible
                 to find the handle using ObFindHandleForObject()! */
                 *JobHandle = hJob;
             }
-            _SEH_HANDLE
+            _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
             {
-                Status = _SEH_GetExceptionCode();
+                Status = _SEH2_GetExceptionCode();
             }
-            _SEH_END;
+            _SEH2_END;
         }
     }
 
@@ -321,7 +317,7 @@ NtCreateJobObject (
  * @implemented
  */
 NTSTATUS
-STDCALL
+NTAPI
 NtIsProcessInJob (
     IN HANDLE ProcessHandle,
     IN HANDLE JobHandle OPTIONAL )
@@ -389,7 +385,7 @@ NtIsProcessInJob (
  * @implemented
  */
 NTSTATUS
-STDCALL
+NTAPI
 NtOpenJobObject (
     PHANDLE JobHandle,
     ACCESS_MASK DesiredAccess,
@@ -397,52 +393,44 @@ NtOpenJobObject (
 {
     KPROCESSOR_MODE PreviousMode;
     HANDLE hJob;
-    NTSTATUS Status = STATUS_SUCCESS;
+    NTSTATUS Status;
 
     PAGED_CODE();
 
     PreviousMode = ExGetPreviousMode();
 
     /* check for valid buffers */
-    if(PreviousMode != KernelMode)
+    if (PreviousMode != KernelMode)
     {
-        _SEH_TRY
+        _SEH2_TRY
         {
             ProbeForWriteHandle(JobHandle);
         }
-        _SEH_HANDLE
-        {
-            Status = _SEH_GetExceptionCode();
-        }
-        _SEH_END;
-
-        if(!NT_SUCCESS(Status))
+        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
         {
-            return Status;
+            _SEH2_YIELD(return _SEH2_GetExceptionCode());
         }
+        _SEH2_END;
     }
 
+    Status = ObOpenObjectByName(ObjectAttributes,
+        PsJobType,
+        PreviousMode,
+        NULL,
+        DesiredAccess,
+        NULL,
+        &hJob);
     if(NT_SUCCESS(Status))
     {
-        Status = ObOpenObjectByName(ObjectAttributes,
-            PsJobType,
-            PreviousMode,
-            NULL,
-            DesiredAccess,
-            NULL,
-            &hJob);
-        if(NT_SUCCESS(Status))
+        _SEH2_TRY
         {
-            _SEH_TRY
-            {
-                *JobHandle = hJob;
-            }
-            _SEH_HANDLE
-            {
-                Status = _SEH_GetExceptionCode();
-            }
-            _SEH_END;
+            *JobHandle = hJob;
+        }
+        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+        {
+            Status = _SEH2_GetExceptionCode();
         }
+        _SEH2_END;
     }
 
     return Status;
@@ -453,7 +441,7 @@ NtOpenJobObject (
  * @unimplemented
  */
 NTSTATUS
-STDCALL
+NTAPI
 NtQueryInformationJobObject (
     HANDLE JobHandle,
     JOBOBJECTINFOCLASS JobInformationClass,
@@ -470,7 +458,7 @@ NtQueryInformationJobObject (
  * @unimplemented
  */
 NTSTATUS
-STDCALL
+NTAPI
 NtSetInformationJobObject (
     HANDLE JobHandle,
     JOBOBJECTINFOCLASS JobInformationClass,
@@ -486,7 +474,7 @@ NtSetInformationJobObject (
  * @unimplemented
  */
 NTSTATUS
-STDCALL
+NTAPI
 NtTerminateJobObject (
     HANDLE JobHandle,
     NTSTATUS ExitStatus )
@@ -523,7 +511,7 @@ NtTerminateJobObject (
  * @implemented
  */
 PVOID
-STDCALL
+NTAPI
 PsGetJobLock ( PEJOB Job )
 {
     ASSERT(Job);
@@ -535,7 +523,7 @@ PsGetJobLock ( PEJOB Job )
  * @implemented
  */
 PVOID
-STDCALL
+NTAPI
 PsGetJobSessionId ( PEJOB Job )
 {
     ASSERT(Job);
@@ -547,7 +535,7 @@ PsGetJobSessionId ( PEJOB Job )
  * @implemented
  */
 ULONG
-STDCALL
+NTAPI
 PsGetJobUIRestrictionsClass ( PEJOB Job )
 {
     ASSERT(Job);
@@ -559,7 +547,7 @@ PsGetJobUIRestrictionsClass ( PEJOB Job )
  * @unimplemented
  */
 VOID
-STDCALL
+NTAPI
 PsSetJobUIRestrictionsClass(PEJOB Job,
     ULONG UIRestrictionsClass)
 {