Commit d76f5b4a authored by Alexandre Julliard's avatar Alexandre Julliard

win32u: Use the correct length for kernel object names in object attributes.

parent a5463c88
......@@ -450,7 +450,8 @@ static HANDLE get_display_device_init_mutex( void )
snprintf( buffer, ARRAY_SIZE(buffer), "\\Sessions\\%u\\BaseNamedObjects\\display_device_init",
(int)NtCurrentTeb()->Peb->SessionId );
name.Length = name.MaximumLength = asciiz_to_unicode( bufferW, buffer );
name.MaximumLength = asciiz_to_unicode( bufferW, buffer );
name.Length = name.MaximumLength - sizeof(WCHAR);
InitializeObjectAttributes( &attr, &name, OBJ_OPENIF, NULL, NULL );
if (NtCreateMutant( &mutex, MUTEX_ALL_ACCESS, &attr, FALSE ) < 0) return 0;
......
......@@ -554,7 +554,8 @@ static HANDLE get_winstations_dir_handle(void)
sprintf( bufferA, "\\Sessions\\%u\\Windows\\WindowStations", (int)NtCurrentTeb()->Peb->SessionId );
str.Buffer = buffer;
str.Length = str.MaximumLength = asciiz_to_unicode( buffer, bufferA ) - sizeof(WCHAR);
str.MaximumLength = asciiz_to_unicode( buffer, bufferA );
str.Length = str.MaximumLength - sizeof(WCHAR);
InitializeObjectAttributes( &attr, &str, 0, 0, NULL );
status = NtOpenDirectoryObject( &dir, DIRECTORY_CREATE_OBJECT | DIRECTORY_TRAVERSE, &attr );
return status ? 0 : dir;
......
......@@ -1008,7 +1008,8 @@ static HANDLE get_display_device_init_mutex(void)
snprintf( buffer, ARRAY_SIZE(buffer), "\\Sessions\\%u\\BaseNamedObjects\\display_device_init",
(int)NtCurrentTeb()->Peb->SessionId );
name.Length = name.MaximumLength = asciiz_to_unicode( bufferW, buffer );
name.MaximumLength = asciiz_to_unicode( bufferW, buffer );
name.Length = name.MaximumLength - sizeof(WCHAR);
InitializeObjectAttributes( &attr, &name, OBJ_OPENIF, NULL, NULL );
if (NtCreateMutant( &mutex, MUTEX_ALL_ACCESS, &attr, FALSE ) < 0) return 0;
......
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