HANDLE OpenMutex(fdwAccess, fInherit, lpszName) | |||||
DWORD fdwAccess; | /* desired access flag | */ | |||
BOOL fInherit; | /* will child process inherit? | */ | |||
LPTSTR lpszName; | /* name of the mutex | */ |
The OpenMutex function returns a handle for an existing named mutex object.
fdwAccess
Specifies the desired access to the mutex object. For NT/Win32, this access is checked against any security descriptor on the target mutex.
This parameter can have one of the following values:
Value | Meaning |
SYNCHRONIZE | ||
Specifies synchronization access (wait or release) to the mutex object. | ||
MUTEX_ALL_ACCESS | ||
Specifies all possible access flags for the mutex object. |
fInherit
Specifies whether the returned handle will be inherited by a new process created by the current process. A value of TRUE indicates that the new process will inherit the handle.
lpszName
Pointer to a null-terminated string that names the mutex to be opened.
If the function is successful, the return value is an open handle to the specified mutex. Otherwise, the return value is NULL. Use the GetLastError function to obtain extended error information.
The OpenMutex function succeeds if the named mutex exists and the security descriptor for the mutex allows the access requested by the fdwAccess parameter.
If the function is successful, the handle is granted access to the mutex object only to the extent requested by the fdwAccess parameter.
The handle returned by the OpenMutex function may be used with any function that requires a handle to a mutex object.
The OpenMutex function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).
CreateMutex CloseHandle, WaitForSingleObject, WaitForMultipleObjects