Function Reference


_WinAPI_OpenSemaphore

Opens an existing named semaphore object

#include <WinAPIProc.au3>
_WinAPI_OpenSemaphore ( $sSemaphore [, $iAccess = 0x001F0003 [, $bInherit = False]] )

Parameters

$sSemaphore The name of the semaphore to be opened. Name comparisons are case sensitive.
$iAccess [optional] The access to the semaphore object. The function fails if the security descriptor of the specified
object does not permit the requested access for the calling process.
This parameter can be one of the following values.
$SEMAPHORE_ALL_ACCESS (Default)
$SEMAPHORE_MODIFY_STATE
$bInherit [optional] Specifies whether inherites the handle by a processes, valid values:
True - The processes created by this process will inherit the handle.
False - The processes do not inherit this handle (Default).
Constants are defined in APIProcConstants.au3

Return Value

Success: The handle to the semaphore object.
Failure: 0, call _WinAPI_GetLastError() to get extended error information.

Remarks

The function succeeds only if some process has already created the semaphore by using the _WinAPI_CreateSemaphore()
function. The calling process can use the returned handle in any function that requires a handle to
a semaphore object.

Related

_WinAPI_CreateSemaphore

See Also

Search OpenSemaphore in MSDN Library.