Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 非英语OSs中Everyone组的名称_C#_Globalization - Fatal编程技术网

C# 非英语OSs中Everyone组的名称

C# 非英语OSs中Everyone组的名称,c#,globalization,C#,Globalization,我们在创建互斥体的方式上存在问题。问题是: MutexAccessRule rule = new MutexAccessRule("Everyone", MutexRights.FullControl, AccessControlType.Allow); 硬编码的“Everyone”字符串仅适用于英语操作系统,我们如何更改此行以使其适用于所有语言 谷歌今天很有帮助: 看起来像 此代码解决了此问题: SecurityIdentifier sid = new SecurityIdentifie

我们在创建
互斥体的方式上存在问题。问题是:

MutexAccessRule rule = new MutexAccessRule("Everyone", MutexRights.FullControl, AccessControlType.Allow);

硬编码的“Everyone”字符串仅适用于英语操作系统,我们如何更改此行以使其适用于所有语言

谷歌今天很有帮助:

看起来像

此代码解决了此问题:

  SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
  MutexAccessRule rule = new MutexAccessRule(sid, MutexRights.FullControl, AccessControlType.Allow);
VB:


我也有同样的问题,但需要“Everyone”组名的实际本地化字符串,以便能够访问MessageQueue。以下是我找到的解决方案,效果很好:

SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
var acct = sid.Translate(typeof(NTAccount)) as NTAccount;
myMessageQueue.SetPermissions(acct.ToString(), MessageQueueAccessRights.FullControl); 
SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
var acct = sid.Translate(typeof(NTAccount)) as NTAccount;
myMessageQueue.SetPermissions(acct.ToString(), MessageQueueAccessRights.FullControl);