wine-staging/patches/ntoskrnl-Synchronization/0004-ntoskrnl.exe-Implement-KeResetEvent.patch

63 lines
1.8 KiB
Diff
Raw Normal View History

From 87d1900d05c4944b1d1d2cc046e6adf89ae53b78 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Sun, 19 Aug 2018 17:41:17 -0500
Subject: [PATCH 04/17] ntoskrnl.exe: Implement KeResetEvent().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/ntoskrnl.exe/ntoskrnl.c | 10 ----------
dlls/ntoskrnl.exe/sync.c | 19 +++++++++++++++++++
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 97bb30b..99fa910 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -2238,16 +2238,6 @@ ULONG WINAPI KeQueryTimeIncrement(void)
/***********************************************************************
- * KeResetEvent (NTOSKRNL.EXE.@)
- */
-LONG WINAPI KeResetEvent( PRKEVENT Event )
-{
- FIXME("(%p): stub\n", Event);
- 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 05d50ef..f011a60 100644
--- a/dlls/ntoskrnl.exe/sync.c
+++ b/dlls/ntoskrnl.exe/sync.c
@@ -146,3 +146,22 @@ LONG WINAPI KeSetEvent( PRKEVENT event, KPRIORITY increment, BOOLEAN wait )
return ret;
}
+
+/***********************************************************************
+ * KeResetEvent (NTOSKRNL.EXE.@)
+ */
+LONG WINAPI KeResetEvent( PRKEVENT event )
+{
+ HANDLE handle = event->Header.WaitListHead.Blink;
+ LONG ret;
+
+ TRACE("event %p.\n", event);
+
+ EnterCriticalSection( &sync_cs );
+ ret = interlocked_xchg( &event->Header.SignalState, FALSE );
+ if (handle)
+ ResetEvent( handle );
+ LeaveCriticalSection( &sync_cs );
+
+ return ret;
+}
--
2.7.4