问题描述
以字符串形式获取当前用户的 SID。 C++
我一直在思考如何在 c# 中获取 sid 就像这样:System.Security.Principal.WindowsIdentity.GetCurrent().User.Value;
如果有人能给我一个简短的解决方案来将 SID 设为 std::string,我会很高兴。
解决方法
查看这些 WINAPI 函数:
- ConvertStringSidToSid(),将帐户 SID 字符串转换为作为参数所需的 SID,
- LookupAccountSid()