--- trunk/reactos/ntoskrnl/ps/kill.c 2005-03-17 16:09:12 UTC (rev 14161)
+++ trunk/reactos/ntoskrnl/ps/kill.c 2005-03-17 18:51:20 UTC (rev 14162)
@@ -329,11 +329,6 @@
}
ObDeleteHandleTable(Process);
- if(Process->UniqueProcessId != NULL)
- {
- PsDeleteCidHandle(Process->UniqueProcessId, PsProcessType);
- }
-
if (Process != CurrentProcess)
{
KeDetachProcess();
--- trunk/reactos/ntoskrnl/ps/process.c 2005-03-17 16:09:12 UTC (rev 14161)
+++ trunk/reactos/ntoskrnl/ps/process.c 2005-03-17 18:51:20 UTC (rev 14162)
@@ -243,15 +243,23 @@
&hToken);
ObDereferenceObject(Token);
- _SEH_TRY
+ if (NT_SUCCESS(Status))
{
- *TokenHandle = hToken;
+
+ _SEH_TRY
+ {
+ *TokenHandle = hToken;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ if (!NT_SUCCESS(Status))
+ {
+ NtClose(hToken);
+ }
}
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
}
return Status;
@@ -518,6 +526,11 @@
KeDetachProcess();
}
+ if(Process->UniqueProcessId != NULL)
+ {
+ PsDeleteCidHandle(Process->UniqueProcessId, PsProcessType);
+ }
+
MmReleaseMmInfo(Process);
if (Context->IsWorkerQueue)
{
@@ -1371,7 +1384,6 @@
DPRINT("NtOpenProcess() = STATUS_UNSUCCESSFUL\n");
return(STATUS_UNSUCCESSFUL);
}
- return(STATUS_UNSUCCESSFUL);
}