Commit 9062314a authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winex11.drv: Use session BaseNamedObjects for display_device_init mutex.

The mutex is also used in user32, gdi32, and winevulkan, where it is opened through kernel32, which opens it from the session directory. Note that this was also not even using the global BaseNamedObjects and was silently failing to open the mutex.
parent 94ece19f
......@@ -1009,14 +1009,19 @@ NTSTATUS CDECL X11DRV_D3DKMTCheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDP
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'};
UNICODE_STRING name = { sizeof(init_mutexW), sizeof(init_mutexW), (WCHAR *)init_mutexW };
WCHAR bufferW[256];
UNICODE_STRING name = {.Buffer = bufferW};
OBJECT_ATTRIBUTES attr;
HANDLE mutex = 0;
char buffer[256];
HANDLE mutex;
snprintf( buffer, ARRAY_SIZE(buffer), "\\Sessions\\%u\\BaseNamedObjects\\display_device_init",
NtCurrentTeb()->Peb->SessionId );
name.Length = name.MaximumLength = asciiz_to_unicode( bufferW, buffer );
InitializeObjectAttributes( &attr, &name, OBJ_OPENIF, NULL, NULL );
NtCreateMutant( &mutex, MUTEX_ALL_ACCESS, &attr, FALSE );
if (mutex) NtWaitForSingleObject( mutex, FALSE, NULL );
if (NtCreateMutant( &mutex, MUTEX_ALL_ACCESS, &attr, FALSE ) < 0) return 0;
NtWaitForSingleObject( mutex, FALSE, NULL );
return mutex;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment