I have a CSid object holding a well known sid for SYSTEM. Calling Domain() function I can see that the domain is "NT AUTHORITY".
In MSDN I found out this group's SID is "S-1-5", so I tried to use ConvertStringSidToSid() in order to get a PSID for that group but I got an error that the SID stru开发者_StackOverflowcture is incorrect.
Is there a way to get CSid for that group? is it possible?
Thanks a lot! :-)
You need to use AllocateAndInitializeSid
() function for this. See this example in MSDN.
PSID psid;
SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY;
if(! AllocateAndInitializeSid( &SIDAuth, 2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&psid) )
{
printf( "AllocateAndInitializeSid Error %u\n", GetLastError() );
return FALSE;
}
精彩评论