Sets the access control security for a named system event.
Assembly: mscorlib (in mscorlib.dll)
eventSecurity is a null reference (Nothing in Visual Basic).
The user does not have EventWaitHandleRights.ChangePermissions.
The event was not opened with EventWaitHandleRights.ChangePermissions.
The current EventWaitHandle object does not represent a named system event.
The following code example demonstrates the cross-process behavior of a named system event with access control security. The example uses the OpenExisting(String) method overload to test for the existence of a named event.
If the event does not exist, it is created with initial ownership and access control security that denies the current user the right to use the event, but grants the right to read and change permissions on the event.
If you run the compiled example from two command windows, the second copy will throw an access violation exception on the call to OpenExisting(String). The exception is caught, and the example uses the OpenExisting(String, EventWaitHandleRights) method overload to wait on the event with the rights needed to read and change the permissions.
After the permissions are changed, using the method, the event is opened with the rights required to wait on it and signal it. If you run the compiled example from a third command window, the example runs using the new permissions.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.