views:

268

answers:

1

Where do I get the ULONG LoginID values to pass to WTSConnectSession? I need both a ULONG LogonId and a ULONG TargetLogonId.

Is this the same as the SessionID I'll get back from WTSQuerySessionInformation when I pass in WTSSessionId? I suspect not (I tried it and WTSConnectSession did not work.)

The MSDN glossay says a logon identifier is a LUID which I can get via GetTokenInformation but that is a structure, not a ULONG. Is there an API to get a ULONG loginId from an LUID?

+2  A: 

You're looking for the session ID from WTSEnumerateSessions, WTSGetActiveConsoleSessionId, ProcessIdToSessionId and so on. The one from WTSQuerySessionInformation is also a session ID, of course.

Remember that you need two session IDs for this function.

Sunlight