revert the changes to NtCreateEvent and do the real fix
Modified: trunk/reactos/ntoskrnl/ex/sem.c
_____
Modified: trunk/reactos/ntoskrnl/ex/sem.c
--- trunk/reactos/ntoskrnl/ex/sem.c 2005-02-10 05:13:43 UTC (rev
13484)
+++ trunk/reactos/ntoskrnl/ex/sem.c 2005-02-10 09:22:27 UTC (rev
13485)
@@ -91,9 +91,9 @@
HANDLE hSemaphore;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
-
+
PreviousMode = ExGetPreviousMode();
-
+
if(PreviousMode == UserMode)
{
_SEH_TRY
@@ -123,42 +123,33 @@
0,
0,
(PVOID*)&Semaphore);
- if (!NT_SUCCESS(Status))
+ if (NT_SUCCESS(Status))
{
KeInitializeSemaphore(Semaphore,
InitialCount,
MaximumCount);
- }
- Status = ObInsertObject ((PVOID)Semaphore,
+ Status = ObInsertObject ((PVOID)Semaphore,
NULL,
DesiredAccess,
0,
NULL,
&hSemaphore);
- if(NT_SUCCESS(Status))
- {
- _SEH_TRY
+ ObDereferenceObject(Semaphore);
+
+ if(NT_SUCCESS(Status))
{
- ObDereferenceObject(Semaphore);
- *SemaphoreHandle = hSemaphore;
+ _SEH_TRY
+ {
+ *SemaphoreHandle = hSemaphore;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
}
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- } else {
- _SEH_TRY
- {
- *SemaphoreHandle = INVALID_HANDLE_VALUE;
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
}
return Status;
Show replies by date