gpt4 book ai didi

c# - 通过 SID 解析显示用户名的最佳方法?

转载 作者:可可西里 更新时间:2023-11-01 12:36:07 24 4
gpt4 key购买 nike

我从注册表中读取了 SID 列表,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

在给定 C# 中的 SID 字符串的情况下,如何解析显示用户名(例如 DOMAIN\userBUILT-IN\user)?

最佳答案

刚在 pinvoke.net 上找到它.

替代托管 API:在 .Net 2.0 中可用:

using System.Security.Principal;

// convert the user sid to a domain\name
string account = new SecurityIdentifier(stringSid).Translate(typeof(NTAccount)).ToString();

关于c# - 通过 SID 解析显示用户名的最佳方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/380031/

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