Commit 94ece19f authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

win32u: 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.
parent da4a45cd
......@@ -406,14 +406,16 @@ void user_check_not_lock(void)
static HANDLE get_display_device_init_mutex( void )
{
static const WCHAR display_device_initW[] =
{'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s',
'\\','d','i','s','p','l','a','y','_','d','e','v','i','c','e','_','i','n','i','t'};
UNICODE_STRING name = { sizeof(display_device_initW), sizeof(display_device_initW),
(WCHAR *)display_device_initW };
WCHAR bufferW[256];
UNICODE_STRING name = {.Buffer = bufferW};
OBJECT_ATTRIBUTES attr;
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 );
if (NtCreateMutant( &mutex, MUTEX_ALL_ACCESS, &attr, FALSE ) < 0) return 0;
NtWaitForSingleObject( mutex, FALSE, NULL );
......
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