gpt4 book ai didi

c# - 非英文操作系统Everyone组名

转载 作者:太空狗 更新时间:2023-10-29 19:59:18 26 4
gpt4 key购买 nike

我们创建 Mutex 的方式有问题。问题行是:

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

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

最佳答案

Google 今天很有帮助:

看起来像this will help

这段代码解决了这个问题:

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

VB:

Dim sid As System.Security.Principal.SecurityIdentifier = New System.Security.Principal.SecurityIdentifier(System.Security.Principal.WellKnownSidType.WorldSid, Nothing)
Dim rule As System.Security.AccessControl.MutexAccessRule = New System.Security.AccessControl.MutexAccessRule(sid, System.Security.AccessControl.MutexRights.FullControl, System.Security.AccessControl.AccessControlType.Allow)

关于c# - 非英文操作系统Everyone组名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/382471/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com