Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MutexSecurity::AddAccessRule Method (MutexAccessRule^)

 

Searches for a matching access control rule with which the new rule can be merged. If none are found, adds the new rule.

Namespace:   System.Security.AccessControl
Assembly:  mscorlib (in mscorlib.dll)

public:
void AddAccessRule(
	MutexAccessRule^ rule
)

Parameters

rule
Type: System.Security.AccessControl::MutexAccessRule^

The access control rule to add.

Exception Condition
ArgumentNullException

rule is null.

IdentityNotMappedException

rule cannot be mapped to a known identity.

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 a MutexSecurity 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.

System_CAPS_noteNote

This example does not attach the security object to a Mutex object. Examples that attach security objects can be found in Mutex::GetAccessControlMutex::SetAccessControl.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show:
© 2017 Microsoft