EventWaitHandleSecurity::AddAccessRule Method (EventWaitHandleAccessRule^)
Searches for a matching access control rule with which the new rule can be merged. If none are found, adds the new rule.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- rule
-
Type:
System.Security.AccessControl::EventWaitHandleAccessRule^
The access control rule to add.
| Exception | Condition |
|---|---|
| ArgumentNullException | rule is null. |
The AddAccessRule method searches for rules with the same user or group and the same AccessControlType as rule. If none are found, rule is added. If a matching rule is found, the rights in rule are merged with the existing rule.
The following code example demonstrates the separation between Allow rules and Deny rules, and shows the combination of rights in compatible rules. The example creates an EventWaitHandleSecurity object, adds rules that allow and deny various rights for the current user, and displays the resulting pair of rules. The example then allows new rights for the current user and displays the result, showing that the new rights are merged with the existing Allow rule.
Note |
|---|
This example does not attach the security object to a EventWaitHandle object. Examples that attach security objects can be found in EventWaitHandle::GetAccessControl and EventWaitHandle::SetAccessControl. |
Available since 2.0
