Reputation: 173
I Want to get the username or SID from a session id value, how can I do that working from Window XP using the WinAPI?
Upvotes: 3
Views: 6530
Reputation: 22327
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.
Upvotes: 5
Reputation: 22311
You can use the WTSQuerySessionInformation
function to get the Username and Domain (WTSUserName
and WTSDomainName
from WTS_INFO_CLASS
).
This function is available as far back as Windows 2000.
Upvotes: 8