获取当前用户的 SID 作为 std::string。 C++

Get SID of current user as std::string. c++

获取当前用户的 SID 作为字符串。 C++

我一直在想如何在 C# 中获取 sid 就像这样很简单:System.Security.Principal.WindowsIdentity.GetCurrent().User.Value;

如果有人能给我简短的解决方案来获得 SID 作为 std::string 我会很高兴。

查看这些 WINAPI 函数:

  • ConvertStringSidToSid(),将帐户 SID 字符串转换为需要作为参数的 SID,
  • LookupAccountSid()