From e79d53d2194bc662be4853e2adf9e98be03751ce Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 19 Aug 2018 17:39:23 -0500 Subject: [PATCH 03/17] ntoskrnl.exe: Implement KeSetEvent(). Signed-off-by: Zebediah Figura --- dlls/ntoskrnl.exe/ntoskrnl.c | 10 ---------- dlls/ntoskrnl.exe/sync.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index e61b18d..97bb30b 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2248,16 +2248,6 @@ LONG WINAPI KeResetEvent( PRKEVENT Event ) /*********************************************************************** - * KeSetEvent (NTOSKRNL.EXE.@) - */ -LONG WINAPI KeSetEvent( PRKEVENT Event, KPRIORITY Increment, BOOLEAN Wait ) -{ - FIXME("(%p, %d, %d): stub\n", Event, Increment, Wait); - return 0; -} - - -/*********************************************************************** * KeSetPriorityThread (NTOSKRNL.EXE.@) */ KPRIORITY WINAPI KeSetPriorityThread( PKTHREAD Thread, KPRIORITY Priority ) diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index e7ff7ec..05d50ef 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" #include #include "ntstatus.h" @@ -125,3 +127,22 @@ void WINAPI KeInitializeEvent( PRKEVENT event, EVENT_TYPE type, BOOLEAN state ) event->Header.WaitListHead.Blink = NULL; event->Header.WaitListHead.Flink = NULL; } + +/*********************************************************************** + * KeSetEvent (NTOSKRNL.EXE.@) + */ +LONG WINAPI KeSetEvent( PRKEVENT event, KPRIORITY increment, BOOLEAN wait ) +{ + HANDLE handle = event->Header.WaitListHead.Blink; + LONG ret; + + TRACE("event %p, increment %d, wait %u.\n", event, increment, wait); + + EnterCriticalSection( &sync_cs ); + ret = interlocked_xchg( &event->Header.SignalState, TRUE ); + if (handle) + SetEvent( handle ); + LeaveCriticalSection( &sync_cs ); + + return ret; +} -- 2.7.4