Signed-off-by: Derek Lesho dereklesho52@Gmail.com --- dlls/ntoskrnl.exe/sync.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 3085543727..bb2d318e56 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -668,13 +668,12 @@ PSLIST_ENTRY WINAPI NTOSKRNL_ExInterlockedPushEntrySList( PSLIST_HEADER list, PS DEFINE_FASTCALL1_WRAPPER(ExAcquireFastMutexUnsafe) void WINAPI ExAcquireFastMutexUnsafe( FAST_MUTEX *mutex ) { - LONG count; - TRACE("mutex %p.\n", mutex);
- count = InterlockedDecrement( &mutex->Count ); - if (count < 0) + if (InterlockedDecrement(&mutex->Count) < 0) KeWaitForSingleObject( &mutex->Event, Executive, KernelMode, FALSE, NULL ); + + mutex->Owner = KeGetCurrentThread(); }
/*********************************************************************** @@ -683,11 +682,10 @@ void WINAPI ExAcquireFastMutexUnsafe( FAST_MUTEX *mutex ) DEFINE_FASTCALL1_WRAPPER(ExReleaseFastMutexUnsafe) void WINAPI ExReleaseFastMutexUnsafe( FAST_MUTEX *mutex ) { - LONG count; - TRACE("mutex %p.\n", mutex);
- count = InterlockedIncrement( &mutex->Count ); - if (count < 1) + mutex->Owner = NULL; + + if (InterlockedIncrement(&mutex->Count) < 1) KeSetEvent( &mutex->Event, IO_NO_INCREMENT, FALSE ); }