4 * Copyright 1998 Alexandre Julliard
14 /***********************************************************************
15 * CreateMutex32A (KERNEL32.166)
17 HANDLE WINAPI CreateMutexA( SECURITY_ATTRIBUTES *sa, BOOL owner, LPCSTR name )
19 struct create_mutex_request *req = get_req_buffer();
22 req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
23 lstrcpynA( req->name, name ? name : "", server_remaining(req->name) );
25 server_call( REQ_CREATE_MUTEX );
26 if (req->handle == -1) return 0;
31 /***********************************************************************
32 * CreateMutex32W (KERNEL32.167)
34 HANDLE WINAPI CreateMutexW( SECURITY_ATTRIBUTES *sa, BOOL owner,
37 LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, name );
38 HANDLE ret = CreateMutexA( sa, owner, nameA );
39 if (nameA) HeapFree( GetProcessHeap(), 0, nameA );
44 /***********************************************************************
45 * OpenMutex32A (KERNEL32.541)
47 HANDLE WINAPI OpenMutexA( DWORD access, BOOL inherit, LPCSTR name )
49 struct open_mutex_request *req = get_req_buffer();
52 req->inherit = inherit;
53 lstrcpynA( req->name, name ? name : "", server_remaining(req->name) );
54 server_call( REQ_OPEN_MUTEX );
55 if (req->handle == -1) return 0; /* must return 0 on failure, not -1 */
60 /***********************************************************************
61 * OpenMutex32W (KERNEL32.542)
63 HANDLE WINAPI OpenMutexW( DWORD access, BOOL inherit, LPCWSTR name )
65 LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, name );
66 HANDLE ret = OpenMutexA( access, inherit, nameA );
67 if (nameA) HeapFree( GetProcessHeap(), 0, nameA );
72 /***********************************************************************
73 * ReleaseMutex (KERNEL32.582)
75 BOOL WINAPI ReleaseMutex( HANDLE handle )
77 struct release_mutex_request *req = get_req_buffer();
79 return !server_call( REQ_RELEASE_MUTEX );