I tried to pass to a function a SID identifier
myFunction(SID userSid) {}
My seed is "S-1-5-11", but i cannot figure how to pass the SID to the function
PSID sid = "S-1-5-11";
myFunction(sid);
No constructor for PSID to _SID
SID
is a distinct type. It is an opaque data structure (implemented as a C structure), not just another name for a string.
You cannot pass a string to a function that requires an SID
formal parameter. You need to create an SID
object and pass that.
There are a variety of API functions that allow you to create and manipulate SIDs; they are listed here.
If you want to create an SID
from a string that contains a valid SID, you can call the ConvertStringSidToSid
function. For example:
PSID psid;
BOOL bSucceeded = ConvertStringSidToSid(TEXT("S-1-5-11"), &psid);
assert(bSucceeded != FALSE);
// ... use the SID via the pointer
// once you are finished, free it:
LocalFree(psid);