mirror of
git://source.winehq.org/git/wine.git
synced 2024-07-21 10:36:58 +00:00
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.
This commit is contained in:
parent
da4a45cdaf
commit
94ece19f8e
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue