|
Dieser Artikel wurde manuell übersetzt. Bewegen Sie den Mauszeiger über die Sätze im Artikel, um den Originaltext anzuzeigen.
|
Übersetzung
Original
|
MutexRights-Enumeration
Diese Enumeration verfügt über ein FlagsAttribute-Attribut, das die bitweise Kombination der Memberwerte zulässt.
Namespace: System.Security.AccessControlAssembly: mscorlib (in mscorlib.dll)
| Membername | Beschreibung | |
|---|---|---|
| Modify | ||
| Delete | ||
| ReadPermissions | ||
| ChangePermissions | ||
| TakeOwnership | ||
| Synchronize | ||
| FullControl |
Hinweis |
|---|
Hinweis |
|---|
using System; using System.Threading; using System.Security.AccessControl; using System.Security.Principal; public class Example { public static void Main() { // Create a string representing the current user. string user = Environment.UserDomainName + "\\" + Environment.UserName; // Create a security object that grants no access. MutexSecurity mSec = new MutexSecurity(); // Add a rule that grants the current user the // right to enter or release the mutex. MutexAccessRule rule = new MutexAccessRule(user, MutexRights.Synchronize | MutexRights.Modify, AccessControlType.Allow); mSec.AddAccessRule(rule); // Add a rule that denies the current user the // right to change permissions on the mutex. rule = new MutexAccessRule(user, MutexRights.ChangePermissions, AccessControlType.Deny); mSec.AddAccessRule(rule); // Display the rules in the security object. ShowSecurity(mSec); // Add a rule that allows the current user the // right to read permissions on the mutex. This rule // is merged with the existing Allow rule. rule = new MutexAccessRule(user, MutexRights.ReadPermissions, AccessControlType.Allow); mSec.AddAccessRule(rule); ShowSecurity(mSec); } private static void ShowSecurity(MutexSecurity security) { Console.WriteLine("\r\nCurrent access rules:\r\n"); foreach(MutexAccessRule ar in security.GetAccessRules(true, true, typeof(NTAccount))) { Console.WriteLine(" User: {0}", ar.IdentityReference); Console.WriteLine(" Type: {0}", ar.AccessControlType); Console.WriteLine(" Rights: {0}", ar.MutexRights); Console.WriteLine(); } } } /*This code example produces output similar to following: Current access rules: User: TestDomain\TestUser Type: Deny Rights: ChangePermissions User: TestDomain\TestUser Type: Allow Rights: Modify, Synchronize Current access rules: User: TestDomain\TestUser Type: Deny Rights: ChangePermissions User: TestDomain\TestUser Type: Allow Rights: Modify, ReadPermissions, Synchronize */
Windows 7, Windows Vista SP1 oder höher, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core wird nicht unterstützt), Windows Server 2008 R2 (Server Core wird mit SP1 oder höher unterstützt), Windows Server 2003 SP2
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.
Hinweis