according to MSDN they are implemented in the same way as a fast mutex.
-- v6: ntoskrnl.exe: Implement KeReleaseGuardedMutex.
From: Etaash Mathamsetty etaash.mathamsetty@gmail.com
--- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 ++ dlls/ntoskrnl.exe/sync.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 2447d01458d..8a67ebdf4c8 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -50,6 +50,8 @@ @ stdcall -fastcall IofCompleteRequest(ptr long) @ stdcall -arch=!i386 KeAcquireInStackQueuedSpinLock(ptr ptr) @ stdcall -fastcall KeAcquireInStackQueuedSpinLockAtDpcLevel(ptr ptr) +@ stdcall KeAcquireGuardedMutexUnsafe(ptr) +@ stdcall KeAcquireGuardedMutex(ptr) @ stdcall KeEnterGuardedRegion() @ stdcall KeExpandKernelStackAndCallout(ptr ptr long) @ stdcall KeExpandKernelStackAndCalloutEx(ptr ptr long long ptr) diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index d9b5726b920..2c227974cd7 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -439,6 +439,29 @@ void WINAPI KeInitializeGuardedMutex(PKGUARDED_MUTEX mutex) KeInitializeEvent(&mutex->Event, SynchronizationEvent, FALSE); }
+/*********************************************************************** + * KeAcquireGuardedMutexUnsafe (NTOSKRNL.EXE.@) + */ +void WINAPI KeAcquireGuardedMutexUnsafe(PKGUARDED_MUTEX mutex) +{ + LONG count; + + TRACE("mutex %p.\n", mutex); + + count = InterlockedDecrement( &mutex->Count ); + if (count < 0) + KeWaitForSingleObject( &mutex->Event, Executive, KernelMode, FALSE, NULL ); +} + +/*********************************************************************** + * KeAcquireGuardedMutex (NTOSKRNL.EXE.@) + */ +void WINAPI KeAcquireGuardedMutex(PKGUARDED_MUTEX mutex) +{ + /* FIXME: Enter Guarded Region */ + KeAcquireGuardedMutexUnsafe(mutex); +} + static void CALLBACK ke_timer_complete_proc(PTP_CALLBACK_INSTANCE instance, void *timer_, PTP_TIMER tp_timer) { KTIMER *timer = timer_;
From: Etaash Mathamsetty etaash.mathamsetty@gmail.com
--- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 ++ dlls/ntoskrnl.exe/sync.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 8a67ebdf4c8..4b84f3e304b 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -58,6 +58,8 @@ @ stdcall KeLeaveGuardedRegion() @ stdcall -arch=!i386 KeReleaseInStackQueuedSpinLock(ptr) @ stdcall -fastcall KeReleaseInStackQueuedSpinLockFromDpcLevel(ptr) +@ stdcall KeReleaseGuardedMutexUnsafe(ptr) +@ stdcall KeReleaseGuardedMutex(ptr) @ stub KeSetTimeUpdateNotifyRoutine @ stub KefAcquireSpinLockAtDpcLevel @ stub KefReleaseSpinLockFromDpcLevel diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 2c227974cd7..8ff198efc49 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -462,6 +462,29 @@ void WINAPI KeAcquireGuardedMutex(PKGUARDED_MUTEX mutex) KeAcquireGuardedMutexUnsafe(mutex); }
+/*********************************************************************** + * KeReleaseGuardedMutexUnsafe (NTOSKRNL.EXE.@) + */ +void WINAPI KeReleaseGuardedMutexUnsafe(PKGUARDED_MUTEX mutex) +{ + LONG count; + + TRACE("mutex %p.\n", mutex); + + count = InterlockedIncrement( &mutex->Count ); + if (count < 1) + KeSetEvent( &mutex->Event, IO_NO_INCREMENT, FALSE ); +} + +/*********************************************************************** + * KeReleaseGuardedMutex (NTOSKRNL.EXE.@) + */ +void WINAPI KeReleaseGuardedMutex(PKGUARDED_MUTEX mutex) +{ + KeReleaseGuardedMutexUnsafe(mutex); + /* FIXME: Leave Guarded Region */ +} + static void CALLBACK ke_timer_complete_proc(PTP_CALLBACK_INSTANCE instance, void *timer_, PTP_TIMER tp_timer) { KTIMER *timer = timer_;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=128888
Your paranoid android.
=== debian11 (32 bit report) ===
ws2_32: Unhandled exception: page fault on read access to 0x0000001c in 32-bit code (0x00418dde).