ahmd0
ahmd0

Reputation: 17293

How to copy SID for storage with C++

Say, if I get a user's SID with the following API:

TOKEN_USER* pTU = (TOKEN_USER*)pbytes;
DWORD dwSize;
GetTokenInformation(hToken, TokenUser, pTU, dwSize, &dwSize);

pTU->User.Sid;  //Contains the SID I need

I need to store this SID for later use/comparison in the program. But how do I copy it?

If I do this:

SID globalSIDStorage;
globalSIDStorage = *pTU->User.Sid;

I get an error that:

error C2679: binary '=' : no operator found which takes a right-hand operand of type 'PSID' (or there is no acceptable conversion.

Upvotes: 0

Views: 1159

Answers (1)

Jerry Coffin
Jerry Coffin

Reputation: 490148

You probably want to use CopySid.

Upvotes: 4

Related Questions