c00000fd
c00000fd

Reputation: 22275

ConvertSidToStringSid on SID obtained from a different machine

I'm curious if ConvertSidToStringSid will be able to convert a binary SID that was obtained from a totally different machine than the one this API is called on?

The SID is obtained on the source machine by calling:

GetTokenInformation(hToken, TokenUser, , , );

and then the size of the binary array for SID itself is calculated using GetLengthSid() API.

Upvotes: 1

Views: 248

Answers (1)

Harry Johnston
Harry Johnston

Reputation: 36318

Windows does sometimes needs to manipulate foreign SIDs, e.g., if you connect to a file share on another machine, or connect an external NTFS-formatted disk that has been used on another machine. So it is perfectly capable of doing so.

You'll run into trouble if you try to convert the SID to a username, of course. But something as simple as turning a binary SID into string representation, or vice-versa, will work perfectly.

Upvotes: 3

Related Questions