我想从会话ID值中获取用户名或SID,如何使用WinAPI从Window XP中进行操作?
答案 0 :(得分:6)
您可以使用WTSQuerySessionInformation
function从WTSUserName
获取用户名和域WTSDomainName
和WTS_INFO_CLASS
。
此功能早在Windows 2000中就可用。
答案 1 :(得分:2)
If you need this from a local system service then you can call WTSQueryUserToken to get user token from session ID, and then use method similar to this one to retrieve a user SID (or user/domain name) using GetTokenInformation API.