Location: Symbol Reference > Classes > TJwSecurityToken Class > TJwSecurityToken.CreateWTSQueryUserToken Constructor
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
TJwSecurityToken.CreateWTSQueryUserToken Constructor
Pascal
constructor CreateWTSQueryUserToken(SessionID: TJwSessionId = INVALID_HANDLE_VALUE); virtual; overload;
Parameters 
Description 
SessionID: TJwSessionId = INVALID_HANDLE_VALUE 
defines the session which is used to obtain the token. If set to INVALID_HANDLE_VALUE, the function does the following steps:
  1. Try to open the token of the current console session. Using WtsGetActiveConsoleSessionID to obtain the session ID.
  2. Try to open the token of the current session using the session ID WTS_CURRENT_SESSION

If it fails an exception is raised. 

CreateWTSQueryUserToken opens a token of a logged on user. 

This constructor is only present on Windows XP/2003 or higher systems. This call fails if the thread does not have system privileges (belong to system). Enable SE_TCB_NAME privilege for none system principals. 

This token can be used to get a token from the specified user in a terminal session (also Fast User Switching). For example: This token is necessary to call CreateProcessAsUser to lunch a process in the given terminal session. 

 

Exceptions 
Description 
is raised if the Windows System does not have WTS function support 
is raised if the privilege SE_TCB_NAME is not held. 
if a call to WTSQueryUserToken failed 
Copyright (c) 2010. All rights reserved.
This help was created by Doc-O-Matic sponsored by toolsfactory software inc.
What do you think about this topic? Send feedback!