Location: Symbol Reference > Functions > JwSecurityCurrentThreadUserSID Function
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
JwSecurityCurrentThreadUserSID Function
Pascal
function JwSecurityCurrentThreadUserSID: TJwSecurityThreadUserSID;

JwSecurityCurrentThreadUserSID gets the current process user or impersonated thread user of the current thread that is used to call this function. The caller is responsible to free the SecurityID instance. 

Despite its name, the function does not fail if the current thread is not impersonated. In this case the process user is returned. 

Use:

SD : TJwSecurityDescriptor;
Sid : TJwSecurityThreadUserSID;
...
SD.OwnOwner := true;
SD.Owner := JwSecurityCurrentThreadUserSID;

Sid := JwSecurityCurrentThreadUserSID;
SD.DACL.Add(TJwDiscretionaryAccessControlEntryDeny.Create(nil,[],FILE_EXECUTE,Sid, true)); //see?: true

Sid.Free;
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!