title: Get windows session's user name in c++
body: <p>I am trying to understand better how Windows sessions (TS sessions and log on sessions) works (currently in XP), so maybe my whole question or what I am trying to do is impossible.</p>
  
  <p>I am running a Windows service (in XP), which runs in session 0, and I am trying to get the username attached to this session using <code>WTSQueryUserToken()</code>.
  Now, in session 0 there are several usernames: <code>SYSTEM</code>, <code>theuser</code> (logged on user),<code>NETWORK SERVICE</code>, <code>LOCAL SERVICE</code>.</p>
  
  <p>When I use <code>WTSQueryUserToken()</code> I get "theuser" (which is the Active session), but I am trying to get the username of my service (which is SYSTEM).
  Is that possible or did I simply get it all wrong?</p>