Patch to fix NtCreateSempahore, in the case where the initial lookup
succeeds.  We previously left the function without initializing 
hSemaphore.  Patch suggested by me and executed by hpoussin.
Modified: trunk/reactos/ntoskrnl/ex/sem.c

Modified: trunk/reactos/ntoskrnl/ex/sem.c
--- trunk/reactos/ntoskrnl/ex/sem.c	2005-02-10 01:42:58 UTC (rev 13482)
+++ trunk/reactos/ntoskrnl/ex/sem.c	2005-02-10 03:58:03 UTC (rev 13483)
@@ -128,28 +128,37 @@
      KeInitializeSemaphore(Semaphore,
 			   InitialCount,
 			   MaximumCount);
+   }
 
-     Status = ObInsertObject ((PVOID)Semaphore,
+   Status = ObInsertObject ((PVOID)Semaphore,
 			      NULL,
 			      DesiredAccess,
 			      0,
 			      NULL,
 			      &hSemaphore);
 
-     ObDereferenceObject(Semaphore);
-   
-     if(NT_SUCCESS(Status))
+   if(NT_SUCCESS(Status))
+   {
+     _SEH_TRY
      {
-       _SEH_TRY
-       {
-         *SemaphoreHandle = hSemaphore;
-       }
-       _SEH_HANDLE
-       {
-         Status = _SEH_GetExceptionCode();
-       }
-       _SEH_END;
+       ObDereferenceObject(Semaphore);
+       *SemaphoreHandle = hSemaphore;
      }
+     _SEH_HANDLE
+     {
+       Status = _SEH_GetExceptionCode();
+     }
+     _SEH_END;
+   } else {
+     _SEH_TRY
+     {
+       *SemaphoreHandle = INVALID_HANDLE_VALUE;
+     }
+     _SEH_HANDLE
+     {
+       Status = _SEH_GetExceptionCode();
+     }
+     _SEH_END;
    }
 
    return Status;