|
RtkOpenSemaphore returns a handle of an existing named semaphore object.
Syntax
HANDLE RtkOpenSemaphore( RTSSINST RtssInst, PULONG pErrorCode, DWORD DesiredAccess, BOOL bInheritHandle, PUNICODE_STRING lpName );
Parameters
RtssInst
An RTSSINST value returned from a call to RtkRtssAttach.
pErrorCode
A pointer to a location where additional error information may be returned. This location need not be defined; the user may pass a NULL value. If defined, this location is set to NULL if no error occurred.
DesiredAccess
The requested access to the semaphore object. This parameter can be any combination of the following values:
bInheritHandle
This must be FALSE.
lpName
A pointer to a PUNICODE_STRING specifying the name of the semaphore object. The name is limited to RTX_MAX_PATH characters and can contain any character except the backslash path-separator character (\). Name comparison is case-sensitive.
Return Values
A handle of the semaphore object if the function succeeds, NULL if the function fails
Remarks
RtkOpenSemaphore enables multiple processes to open handles of the same semaphore object. The function succeeds only if some process has already created the semaphore by using RtkCreateSemaphore. The calling process can use the returned handle in any function that requires a handle of a semaphore object, such as a wait function, subject to the limitations of the access specified in DesiredAccess.
Use RtkCloseHandle to close the handle. The system closes the handle automatically when the process terminates. The semaphore object is destroyed when its last handle has been closed.
Requirements
Header | Rtkapi.h |
Library | rtx_rtk.lib |
See Also: