From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/display.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c index 75904bd6f5f..a5abf426cc5 100644 --- a/dlls/winemac.drv/display.c +++ b/dlls/winemac.drv/display.c @@ -74,17 +74,21 @@ static BOOL inited_original_display_mode;
static HANDLE get_display_device_init_mutex(void) { - static const WCHAR init_mutexW[] = {'d','i','s','p','l','a','y','_','d','e','v','i','c','e','_','i','n','i','t',0}; - HANDLE mutex = CreateMutexW(NULL, FALSE, init_mutexW); - - WaitForSingleObject(mutex, INFINITE); + static const WCHAR init_mutexW[] = {'d','i','s','p','l','a','y','_','d','e','v','i','c','e','_','i','n','i','t'}; + UNICODE_STRING name = { sizeof(init_mutexW), sizeof(init_mutexW), (WCHAR *)init_mutexW }; + OBJECT_ATTRIBUTES attr; + HANDLE mutex = 0; + + InitializeObjectAttributes(&attr, &name, OBJ_OPENIF, NULL, NULL); + NtCreateMutant(&mutex, MUTEX_ALL_ACCESS, &attr, FALSE); + if (mutex) NtWaitForSingleObject(mutex, FALSE, NULL); return mutex; }
static void release_display_device_init_mutex(HANDLE mutex) { - ReleaseMutex(mutex); - CloseHandle(mutex); + NtReleaseMutant(mutex, NULL); + NtClose(mutex); }
static BOOL get_display_device_reg_key(const WCHAR *device_name, WCHAR *key, unsigned len)