Location: Symbol Reference > Classes > TJwSecurityToken Class > TJwSecurityToken.CreateNewToken Constructor
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
TJwSecurityToken.CreateNewToken Constructor
Pascal
constructor CreateNewToken(const aDesiredAccess: TJwAccessMask; const anObjectAttributes: TObjectAttributes; const anAuthenticationId: TLUID; const anExpirationTime: int64; anUser: TJwSecurityId; aGroups: TJwSecurityIdList; aPrivileges: TJwPrivilegeSet; anOwner: TJwSecurityId; aPrimaryGroup: TJwSecurityId; aDefaultDACL: TJwDAccessControlList; aTokenSource: TTokenSource); virtual;

CreateNewToken forges a new token using ZwCreateToken. This function can only be called successfully when the CREATE_TOKEN privilege is available and the current process it the SYSTEM user. If the current process is a SYSTEM process but the CREATE_TOKEN privilege is missing, retrieve the token from the csrss.exe (session 0) impersonate it and call CreateNewToken. In this way, no restart of Windows is necessary which would be because you had to add the privilege to the SYSTEM account.

Exceptions 
Description 
if SE_CREATE_TOKEN_NAME is not available ZwCreateToken( 
PHANDLE; 
DesiredAccess 
ACCESS_MASK; 
ObjectAttributes 
POBJECT_ATTRIBUTES; 
Type_ 
TOKEN_TYPE; 
AuthenticationId 
PLUID; 
ExpirationTime 
PLARGE_INTEGER; 
User 
PTOKEN_USER; 
Groups 
PTOKEN_GROUPS; 
Privileges 
PTOKEN_PRIVILEGES; 
Owner 
PTOKEN_OWNER; 
PTOKEN_PRIMARY_GROUP; 
DefaultDacl 
PTOKEN_DEFAULT_DACL; 
Source 
PTOKEN_SOURCE): 
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!