Andrey Turkin : kernel32: Use TEB-based buffer in CreateMutexExA.

Alexandre Julliard julliard at winehq.org
Wed Feb 24 10:21:32 CST 2010


Module: wine
Branch: master
Commit: 2db497e89e8e4a37a8bd569b8691b9b87ae63606
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2db497e89e8e4a37a8bd569b8691b9b87ae63606

Author: Andrey Turkin <andrey.turkin at gmail.com>
Date:   Tue Feb 23 18:41:27 2010 +0300

kernel32: Use TEB-based buffer in CreateMutexExA.

---

 dlls/kernel32/sync.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c
index fbe055d..0ba2ad1 100644
--- a/dlls/kernel32/sync.c
+++ b/dlls/kernel32/sync.c
@@ -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 );
 }
 
 




More information about the wine-cvs mailing list