EventWaitHandleAcl.TryOpenExisting Method

Definition

Tries to open a specified named event wait handle, if it already exists, applies the desired access rights, and returns a value that indicates whether the operation succeeded.

public:
 static bool TryOpenExisting(System::String ^ name, System::Security::AccessControl::EventWaitHandleRights rights, [Runtime::InteropServices::Out] System::Threading::EventWaitHandle ^ % result);
public static bool TryOpenExisting (string name, System.Security.AccessControl.EventWaitHandleRights rights, out System.Threading.EventWaitHandle? result);
public static bool TryOpenExisting (string name, System.Security.AccessControl.EventWaitHandleRights rights, out System.Threading.EventWaitHandle result);
static member TryOpenExisting : string * System.Security.AccessControl.EventWaitHandleRights * EventWaitHandle -> bool
Public Shared Function TryOpenExisting (name As String, rights As EventWaitHandleRights, ByRef result As EventWaitHandle) As Boolean

Parameters

name
String

The name of the event wait handle to be opened. If it's prefixed by "Global", it refers to a machine-wide event wait handle. If it's prefixed by "Local", or doesn't have a prefix, it refers to a session-wide event wait handle. Both prefix and name are case-sensitive.

rights
EventWaitHandleRights

The desired access rights to apply to the returned event wait handle.

result
EventWaitHandle

When this method returns true, contains an object that represents the named event wait handle if the call succeeded, or null otherwise. This parameter is treated as uninitialized.

Returns

true if the named event wait handle was opened successfully; otherwise, false.

Exceptions

name is null

name is an empty string.

A Win32 error occurred.

The named event wait handle exists, but the user does not have the security access required to use it.

Applies to