There is a problem between SID and user's name. When you change the user name
in the 'User and User Group' console panel, if not logoff or restart, the OS
will make mistakes. For example, examine the property of 'My Computer', it
would prompt that pidl errors. I want to get the user's SID by
LookupAccountName(), it prompt that no mapping between the user' name and
SID.
I try to use OpenProcessToken and GetTokenInformation get the current user's
SID, and successfully. But if the process run as by administrator, this
operation would get the SID of administrator but not the current user's. Is
there another function that get the SID of the current user in this condition?
Thank you.
|