Windows has cmd " request session , it displays session information on the terminal server, session_name".
I want to use the Windows API ------ LsaEnumerateLogonSessions and LsaGetLogonSessionData strong> to get this session information as follows:
int main() { int i = 0; ULONG count = 0; PLUID list = NULL; PSECURITY_LOGON_SESSION_DATA data; LsaEnumerateLogonSessions(&count, &list); for (i = 0; i < (int)count; i++) { LsaGetLogonSessionData(&list[i], &data); } return 0; }
I can get the SECURITY_LOGON_SESSION_DATA structure:
typedef struct _SECURITY_LOGON_SESSION_DATA { ULONG Size; LUID LogonId; LSA_UNICODE_STRING UserName; LSA_UNICODE_STRING LogonDomain; LSA_UNICODE_STRING AuthenticationPackage; ULONG LogonType; ULONG Session; PSID Sid; LARGE_INTEGER LogonTime; LSA_UNICODE_STRING LogonServer; LSA_UNICODE_STRING DnsDomainName; LSA_UNICODE_STRING Upn; ULONG UserFlags; LSA_LAST_INTER_LOGON_INFO LastLogonInfo; LSA_UNICODE_STRING LogonScript; LSA_UNICODE_STRING ProfilePath; LSA_UNICODE_STRING HomeDirectory; LSA_UNICODE_STRING HomeDirectoryDrive; LARGE_INTEGER LogoffTime; LARGE_INTEGER KickOffTime; LARGE_INTEGER PasswordLastSet; LARGE_INTEGER PasswordCanChange; LARGE_INTEGER PasswordMustChange; } SECURITY_LOGON_SESSION_DATA, *PSECURITY_LOGON_SESSION_DATA;
But it does not contain the name of the session !
Any idea on how to get "sessonname"?
source share