RtkOpenSemaphore

RtkOpenSemaphore returns a handle of an existing named semaphore object.

Syntax

Copy
HANDLE RTKAPI RtkOpenSemaphore(
    [in]        RTSSINST RtssInst,
    [out]       PHANDLE SemaphoreHandle,
    [ignored]   ULONG DesiredAccess,
    [ignored]   BOOLEAN InheritHandle,
    [in]        PUNICODE_STRING Name
);

Parameters

[in] RtssInst

An RTSSINST value returned from a call to RtkRtssAttach or RtkRtssAttachEx. Pass a valid RTSSINST value or the call will fail with STATUS_INVALID_PARAMETER.

[out] SemaphoreHandle

A pointer to a handle that will receive a handle to the existing semaphore object. Pass a valid pointer to a handle or the call will fail with STATUS_INVALID_PARAMETER.

[ignored] DesiredAccess

The requested access to the semaphore object.

[ignored] InheritHandle

The handle to inherit.

[in] Name

A pointer to a PUNICODE_STRING specifying the name of the semaphore object. The name is limited to 260 characters and can contain any character except the backslash path-separator character (\). Name comparison is case-sensitive.

Return Value

If the function succeeds, it returns STATUS_SUCCESS. If the function fails, it returns one of the following NTSTATUS error codes:

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 requiring a handle of a semaphore object, such as a wait function, subject to the access limitations 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

Minimum supported version Header Library

IRQL

wRTOS 1.0 SDK

RtkApi.h

RtkApi_W64.lib

PASSIVE_LEVEL

See Also: