How to get token of logged-in user from within windows service with C++?
问题 on windows vista & above, currently, I am enumerating all windows sessions, then once I find an active session, WTSQueryUserToken() is called which gives me the token of current user. This token is used to launch a process with his privileges / inside his desktop. Problem I am facing is that there is not reliable way to get the active session / interactive session. I have to wait (check its presence every few millsecs) until explorer.exe is spawned. I am not preferring notifications like