Commit 2db497e8 authored by Andrey Turkin's avatar Andrey Turkin Committed by Alexandre Julliard

kernel32: Use TEB-based buffer in CreateMutexExA.

parent 240afab3
......@@ -614,16 +614,19 @@ HANDLE WINAPI CreateMutexW( SECURITY_ATTRIBUTES *sa, BOOL owner, LPCWSTR name )
*/
HANDLE WINAPI CreateMutexExA( SECURITY_ATTRIBUTES *sa, LPCSTR name, DWORD flags, DWORD access )
{
WCHAR buffer[MAX_PATH];
ANSI_STRING nameA;
NTSTATUS status;
if (!name) return CreateMutexExW( sa, NULL, flags, access );
if (!MultiByteToWideChar( CP_ACP, 0, name, -1, buffer, MAX_PATH ))
RtlInitAnsiString( &nameA, name );
status = RtlAnsiStringToUnicodeString( &NtCurrentTeb()->StaticUnicodeString, &nameA, FALSE );
if (status != STATUS_SUCCESS)
{
SetLastError( ERROR_FILENAME_EXCED_RANGE );
return 0;
}
return CreateMutexExW( sa, buffer, flags, access );
return CreateMutexExW( sa, NtCurrentTeb()->StaticUnicodeString.Buffer, flags, access );
}
......
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