There is not much to write about how you can obtain the user’s SID.

Use these members

uses JwsclKnownSid, JwsclSid;
var SID : TJwSecurityID;
begin
  SID := JwSecurityCurrentThreadUserSID;
  WriteLn(SID.GetText(true));
  SID.Free;
end;

The SID is either obtained from the thread token or – if it does not exist – from the process token.

Tell me how you liked this blog entry by adding a comment.