[PATCH v3 11/11] ntoskrnl.exe: Implement Ex(Acquire/Release)FastMutex.

Derek Lesho dereklesho52 at gmail.com
Thu Apr 11 13:27:05 CDT 2019


Signed-off-by: Derek Lesho <dereklesho52 at Gmail.com>
---

v3: Removed IRQL raising/restoring functionality, since it needs
a better implementation / more tests.  Also marked it as x86_64 only
as ZF recommended.

 dlls/ntoskrnl.exe/ntoskrnl.exe.spec |  2 ++
 dlls/ntoskrnl.exe/sync.c            | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 399258cdfd..5ec5e492b2 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -1,4 +1,5 @@
 @ stdcall -fastcall ExAcquireFastMutexUnsafe(ptr)
+@ stdcall -arch=x86_64 ExAcquireFastMutex(ptr)
 @ stub ExAcquireRundownProtection
 @ stub ExAcquireRundownProtectionEx
 @ stub ExInitializeRundownProtection
@@ -9,6 +10,7 @@
 @ stdcall -fastcall -arch=i386 ExInterlockedPushEntrySList (ptr ptr ptr) NTOSKRNL_ExInterlockedPushEntrySList
 @ stub ExReInitializeRundownProtection
 @ stdcall -fastcall ExReleaseFastMutexUnsafe(ptr)
+@ stdcall -arch=x86_64 ExReleaseFastMutex(ptr)
 @ stdcall ExReleaseResourceLite(ptr)
 @ stub ExReleaseRundownProtection
 @ stub ExReleaseRundownProtectionEx
diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c
index bb2d318e56..20fefce39f 100644
--- a/dlls/ntoskrnl.exe/sync.c
+++ b/dlls/ntoskrnl.exe/sync.c
@@ -689,3 +689,24 @@ void WINAPI ExReleaseFastMutexUnsafe( FAST_MUTEX *mutex )
     if (InterlockedIncrement(&mutex->Count) < 1)
         KeSetEvent( &mutex->Event, IO_NO_INCREMENT, FALSE );
 }
+
+
+/*********************************************************************
+ *           ExAcquireFastMutex    (NTOSKRNL.@)
+ */
+void WINAPI ExAcquireFastMutex(PFAST_MUTEX mutex)
+{
+    /* TODO: The safe variant raises thread to APC_LEVEL
+       and stores the previous IRQL in mutex->OldIrql */
+    ExAcquireFastMutexUnsafe( mutex );
+}
+
+
+ /*********************************************************************
+ *           ExReleaseFastMutex    (NTOSKRNL.@)
+ */
+void WINAPI ExReleaseFastMutex(PFAST_MUTEX mutex)
+{
+    ExReleaseFastMutexUnsafe( mutex );
+    /* TODO: the safe variant restores the IRQL to mutex->OldIrql */
+}
-- 
2.20.1




More information about the wine-devel mailing list