Click to open or copy the files for the TextSid sample.
This module illustrates how to obtain the textual representation of a binary Sid. This is useful in scenarios where it is not appropriate to obtain the name associated with the Sid, or, when the network is not available to obtain such information. The Windows NT event viewer utility displays Sids in textual form when the username cannot be looked up. Furthermore, lookup of local user profiles is facilitated through conversion of the user Sid to textual form.
This sample obtains the Sid of the current user and then displays the Sid in textual notation.
This sample uses the following keywords:
closehandle; displaywinerror; formatmessagea; fprintf; getcurrentprocess; getlasterror; getsididentifierauthority; getsidsubauthority; getsidsubauthoritycount; getstdhandle; gettextualsid; gettokeninformation; isvalidsid; localfree; makelangid; openprocesstoken; printf; setlasterror; text; writefile; wsprintf