fixed the prototype of KePulseEvent() and made NtPulseEvent() return the previous state
Modified: trunk/reactos/include/ddk/kefuncs.h
Modified: trunk/reactos/ntoskrnl/ex/event.c
Modified: trunk/reactos/ntoskrnl/ke/event.c
Modified: trunk/reactos/w32api/include/ddk/winddk.h

Modified: trunk/reactos/include/ddk/kefuncs.h
--- trunk/reactos/include/ddk/kefuncs.h	2005-01-22 12:20:12 UTC (rev 13208)
+++ trunk/reactos/include/ddk/kefuncs.h	2005-01-22 12:45:03 UTC (rev 13209)
@@ -218,9 +218,9 @@
 
 VOID STDCALL KeLowerIrql (KIRQL	NewIrql);
 
-NTSTATUS STDCALL KePulseEvent (PKEVENT		Event,
-			       KPRIORITY	Increment,
-			       BOOLEAN		Wait);
+LONG STDCALL KePulseEvent (PKEVENT		Event,
+			   KPRIORITY	Increment,
+			   BOOLEAN		Wait);
 
 LARGE_INTEGER
 STDCALL

Modified: trunk/reactos/ntoskrnl/ex/event.c
--- trunk/reactos/ntoskrnl/ex/event.c	2005-01-22 12:20:12 UTC (rev 13208)
+++ trunk/reactos/ntoskrnl/ex/event.c	2005-01-22 12:45:03 UTC (rev 13209)
@@ -295,10 +295,21 @@
 				      NULL);
    if(NT_SUCCESS(Status))
    {
-     KePulseEvent(Event, EVENT_INCREMENT, FALSE);
+     LONG Prev = KePulseEvent(Event, EVENT_INCREMENT, FALSE);
      ObDereferenceObject(Event);
      
-     /* FIXME - Return the previous state! */
+     if(PreviousState != NULL)
+     {
+       _SEH_TRY
+       {
+         *PreviousState = Prev;
+       }
+       _SEH_HANDLE
+       {
+         Status = _SEH_GetExceptionCode();
+       }
+       _SEH_END;
+     }
    }
 
    return Status;

Modified: trunk/reactos/ntoskrnl/ke/event.c
--- trunk/reactos/ntoskrnl/ke/event.c	2005-01-22 12:20:12 UTC (rev 13208)
+++ trunk/reactos/ntoskrnl/ke/event.c	2005-01-22 12:45:03 UTC (rev 13209)
@@ -108,16 +108,17 @@
 /*
  * @implemented
  */
-NTSTATUS STDCALL KePulseEvent (PKEVENT		Event,
-			       KPRIORITY	Increment,
-			       BOOLEAN		Wait)
+LONG STDCALL
+KePulseEvent (IN PKEVENT	Event,
+              IN KPRIORITY	Increment,
+              IN BOOLEAN	Wait)
 {
    KIRQL OldIrql;
-   int ret;
+   LONG Ret;
 
    DPRINT("KePulseEvent(Event %x, Wait %x)\n",Event,Wait);
    OldIrql = KeAcquireDispatcherDatabaseLock();
-   ret = InterlockedExchange(&Event->Header.SignalState,1);
+   Ret = InterlockedExchange(&Event->Header.SignalState,1);
    KiDispatcherObjectWake(&Event->Header, Increment);
    InterlockedExchange(&(Event->Header.SignalState),0);
 
@@ -132,7 +133,7 @@
       Thread->WaitIrql = OldIrql;
     }
 
-   return ((NTSTATUS)ret);
+   return Ret;
 }
 
 /*

Modified: trunk/reactos/w32api/include/ddk/winddk.h
--- trunk/reactos/w32api/include/ddk/winddk.h	2005-01-22 12:20:12 UTC (rev 13208)
+++ trunk/reactos/w32api/include/ddk/winddk.h	2005-01-22 12:45:03 UTC (rev 13209)
@@ -7607,7 +7607,7 @@
   VOID);
 
 NTOSAPI
-NTSTATUS
+LONG
 DDKAPI
 KePulseEvent(
   IN PRKEVENT  Event,