The AllocateAndInitializeSid function allocates and initializes a security identifier (SID) with up to eight subauthorities.
BOOL AllocateAndInitializeSid(
PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, |
// pointer to identifier authority |
BYTE nSubAuthorityCount, |
// count of subauthorities |
DWORD dwSubAuthority0, |
// subauthority 0 |
DWORD dwSubAuthority1, |
// subauthority 1 |
DWORD dwSubAuthority2, |
// subauthority 2 |
DWORD dwSubAuthority3, |
// subauthority 3 |
DWORD dwSubAuthority4, |
// subauthority 4 |
DWORD dwSubAuthority5, |
// subauthority 5 |
DWORD dwSubAuthority6, |
// subauthority 6 |
DWORD dwSubAuthority7, |
// subauthority 7 |
PSID *pSid |
// pointer to pointer to SID |
); |
For example, a value of 3 indicates that the subauthority values specified by
the dwSubAuthority0, dwSubAuthority1, and dwSubAuthority2
parameters have meaningful values and to ignore the remainder.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
An SID allocated with the AllocateAndInitializeSid function must be freed by using the FreeSid function.
FreeSid, GetSidIdentifierAuthority, InitializeSid, SID_IDENTIFIER_AUTHORITY