4 * Copyright 1998 Alexandre Julliard
13 /***********************************************************************
14 * CreateMutex32A (KERNEL32.166)
16 HANDLE WINAPI
CreateMutexA( SECURITY_ATTRIBUTES
*sa
, BOOL owner
, LPCSTR name
)
18 struct create_mutex_request
*req
= get_req_buffer();
21 req
->inherit
= (sa
&& (sa
->nLength
>=sizeof(*sa
)) && sa
->bInheritHandle
);
22 server_strcpyAtoW( req
->name
, name
);
24 server_call( REQ_CREATE_MUTEX
);
25 if (req
->handle
== -1) return 0;
30 /***********************************************************************
31 * CreateMutex32W (KERNEL32.167)
33 HANDLE WINAPI
CreateMutexW( SECURITY_ATTRIBUTES
*sa
, BOOL owner
, LPCWSTR name
)
35 struct create_mutex_request
*req
= get_req_buffer();
38 req
->inherit
= (sa
&& (sa
->nLength
>=sizeof(*sa
)) && sa
->bInheritHandle
);
39 server_strcpyW( req
->name
, name
);
41 server_call( REQ_CREATE_MUTEX
);
42 if (req
->handle
== -1) return 0;
47 /***********************************************************************
48 * OpenMutex32A (KERNEL32.541)
50 HANDLE WINAPI
OpenMutexA( DWORD access
, BOOL inherit
, LPCSTR name
)
52 struct open_mutex_request
*req
= get_req_buffer();
55 req
->inherit
= inherit
;
56 server_strcpyAtoW( req
->name
, name
);
57 server_call( REQ_OPEN_MUTEX
);
58 if (req
->handle
== -1) return 0; /* must return 0 on failure, not -1 */
63 /***********************************************************************
64 * OpenMutex32W (KERNEL32.542)
66 HANDLE WINAPI
OpenMutexW( DWORD access
, BOOL inherit
, LPCWSTR name
)
68 struct open_mutex_request
*req
= get_req_buffer();
71 req
->inherit
= inherit
;
72 server_strcpyW( req
->name
, name
);
73 server_call( REQ_OPEN_MUTEX
);
74 if (req
->handle
== -1) return 0; /* must return 0 on failure, not -1 */
79 /***********************************************************************
80 * ReleaseMutex (KERNEL32.582)
82 BOOL WINAPI
ReleaseMutex( HANDLE handle
)
84 struct release_mutex_request
*req
= get_req_buffer();
86 return !server_call( REQ_RELEASE_MUTEX
);