release the keep-alive reference of the process object
[reactos.git] / reactos / ntoskrnl / ps / kill.c
index 7fbc57b..6e4b8a7 100644 (file)
@@ -396,8 +396,8 @@ PsExitSpecialApc(PKAPC Apc,
                  PVOID* SystemArgument1,
                  PVOID* SystemArguemnt2)
 {
-    DPRINT1("PsExitSpecialApc called: 0x%x (proc: 0x%x, '%.16s')\n", 
-            PsGetCurrentThread(), PsGetCurrentProcess(), PsGetCurrentProcess()->ImageFileName);
+    DPRINT("PsExitSpecialApc called: 0x%x (proc: 0x%x, '%.16s')\n", 
+           PsGetCurrentThread(), PsGetCurrentProcess(), PsGetCurrentProcess()->ImageFileName);
 
     /* Don't do anything unless we are in User-Mode */
     if (Apc->SystemArgument2)
@@ -425,8 +425,8 @@ PspExitNormalApc(PVOID NormalContext,
     PETHREAD Thread = PsGetCurrentThread();
     NTSTATUS ExitStatus;
         
-    DPRINT1("PspExitNormalApc called: 0x%x (proc: 0x%x, '%.16s')\n", 
-            PsGetCurrentThread(), PsGetCurrentProcess(), PsGetCurrentProcess()->ImageFileName);
+    DPRINT("PspExitNormalApc called: 0x%x (proc: 0x%x, '%.16s')\n", 
+           PsGetCurrentThread(), PsGetCurrentProcess(), PsGetCurrentProcess()->ImageFileName);
 
     /* This should never happen */
     ASSERT(!SystemArgument2);
@@ -446,7 +446,7 @@ PspExitNormalApc(PVOID NormalContext,
     }
 
     /* If we're here, this is not a System Thread, so kill it from User-Mode */
-    DPRINT1("Initializing User-Mode APC\n");
+    DPRINT("Initializing User-Mode APC\n");
     KeInitializeApc(Apc,
                     &Thread->Tcb,
                     OriginalApcEnvironment,
@@ -524,6 +524,9 @@ PspExitProcess(PEPROCESS Process)
     ObKillProcess(Process);
 
     KeSetProcess(&Process->Pcb, IO_NO_INCREMENT);
+    
+    /* release the keep-alive reference of the process object */
+    ObDereferenceObject(Process);
 
     return(STATUS_SUCCESS);
 }