开发者

ConvertStringSidToSid for S-1-5 (NT AUTHORITY group)

开发者 https://www.devze.com 2023-02-06 10:42 出处:网络
I have a CSid object holding a well known sid for SYSTEM. Calling Domain() function I can see that the domain is \"NT AUTHORITY\".

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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消