From 07bc793086700ec42b25667e3e019a616ed13723 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 19 Aug 2018 21:24:51 -0500 Subject: [PATCH 10/17] ntoskrnl.exe: Implement KeInitializeMutex(). Signed-off-by: Zebediah Figura --- dlls/ntoskrnl.exe/ntoskrnl.c | 9 --------- dlls/ntoskrnl.exe/sync.c | 14 ++++++++++++++ include/ddk/wdm.h | 1 + 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index b367323..920fb74 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2086,15 +2086,6 @@ PRKTHREAD WINAPI KeGetCurrentThread(void) } /*********************************************************************** - * KeInitializeMutex (NTOSKRNL.EXE.@) - */ -void WINAPI KeInitializeMutex(PRKMUTEX Mutex, ULONG Level) -{ - FIXME( "stub: %p, %u\n", Mutex, Level ); -} - - - /*********************************************************************** * KeWaitForMutexObject (NTOSKRNL.EXE.@) */ NTSTATUS WINAPI KeWaitForMutexObject(PRKMUTEX Mutex, KWAIT_REASON WaitReason, KPROCESSOR_MODE WaitMode, diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 30160f7..7535ae8 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -38,6 +38,7 @@ enum object_type { TYPE_MANUAL_EVENT = 0, TYPE_AUTO_EVENT = 1, + TYPE_MUTEX = 2, TYPE_SEMAPHORE = 5, }; @@ -228,3 +229,16 @@ LONG WINAPI KeReleaseSemaphore( PRKSEMAPHORE semaphore, KPRIORITY increment, return ret; } + +/*********************************************************************** + * KeInitializeMutex (NTOSKRNL.EXE.@) + */ +void WINAPI KeInitializeMutex( PRKMUTEX mutex, ULONG level ) +{ + TRACE("mutex %p, level %u.\n", mutex, level); + + mutex->Header.Type = TYPE_MUTEX; + mutex->Header.SignalState = 1; + mutex->Header.WaitListHead.Blink = NULL; + mutex->Header.WaitListHead.Flink = NULL; +} diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 6b6ac19..c8adc7d 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1421,6 +1421,7 @@ NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT,ULONG); void WINAPI KeClearEvent(PRKEVENT); PKTHREAD WINAPI KeGetCurrentThread(void); void WINAPI KeInitializeEvent(PRKEVENT,EVENT_TYPE,BOOLEAN); +void WINAPI KeInitializeMutex(PRKMUTEX,ULONG); void WINAPI KeInitializeSemaphore(PRKSEMAPHORE,LONG,LONG); void WINAPI KeInitializeTimerEx(PKTIMER,TIMER_TYPE); void WINAPI KeQuerySystemTime(LARGE_INTEGER*); -- 2.7.4