EventWaitHandleSecurity::RemoveAccessRuleSpecific Method (EventWaitHandleAccessRule^)
Searches for an access control rule that exactly matches the specified rule and, if found, removes it.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- rule
-
Type:
System.Security.AccessControl::EventWaitHandleAccessRule^
The EventWaitHandleAccessRule to remove.
| Exception | Condition |
|---|---|
| ArgumentNullException | rule is null. |
The rule is removed only if it exactly matches rule in all details, including flags. Other rules with the same user and AccessControlType are not affected.
Important |
|---|
A rule represents one or more underlying access control entries (ACE), and these entries are split or combined as necessary when you modify the access security rules for a user. Thus, a rule might no longer exist in the specific form it had when it was added, and in that case the RemoveAccessRuleSpecific method cannot remove it. |
The following code example shows that the RemoveAccessRuleSpecific method requires an exact match in order to remove a rule, and that rules to allow and deny rights are independent of each other.
The example creates an EventWaitHandleSecurity object, adds rules that allow and deny various rights for the current user, and then merges additional rights into the Allow access rule. The example then passes the original Allow rule to the RemoveAccessRuleSpecific method, and displays the results, showing that nothing is deleted. The example then constructs a rule that matches the Allow rule in the EventWaitHandleSecurity object, and successfully uses the RemoveAccessRuleSpecific method to remove the 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

