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::SetAccessRule Method (MutexAccessRule^)

 

Removes all access control rules with the same user and AccessControlType (allow or deny) as the specified rule, and then adds the specified rule.

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

public:
void SetAccessRule(
	MutexAccessRule^ rule
)

Parameters

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

The MutexAccessRule to add. The user and AccessControlType of this rule determine the rules to remove before this rule is added.

Exception Condition
ArgumentNullException

rule is null.

If the specified rule has Allow, the effect of this method is to remove all Allow rules for the specified user, replacing them with the specified rule. If the specified rule has Deny, all Deny rules for the specified user are replaced with the specified rule.

If there are no rules whose user and AccessControlType match the specified rule, rule is added.

The following code example shows how the SetAccessRule method removes all rules that match both the user and the AccessControlType of rule, replacing them with rule.

The example creates a MutexSecurity object and adds rules that allow and deny various rights for the current user. The example then creates a new rule that allows the current user full control, and uses the SetAccessRule method to replace the existing Allow rule with the new rule. The rule that denies access is not affected.

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::GetAccessControl and Mutex::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