title: C++ WTSQueryUserToken Function Error
body: <p>I'm trying to get my service to create a process as a user, but I have to get the token first. Now for some reason, My function keeps returning error 87, which is ERROR_INVALID_PARAMETER. Anyone know why? It's been bugging me for hours, the parameters are correct from what I see. Thanks.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>PHANDLE currentToken = 0;
  ULONG id = WTSGetActiveConsoleSessionId();
      printf("ULONG = %d", id);
  // Get token of the logged in user by the active session ID
  BOOL bRet = WTSQueryUserToken(id, currentToken);
  if (bRet == false)
  {
      printf("ERROR: %d", GetLastError());
  }
  </code></pre>