Platform SDK: Access Control |
The AllocateAndInitializeSid function allocates and initializes a security identifier (SID) with up to eight subauthorities.
BOOL AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, // 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 // 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.
Windows NT/2000: Requires Windows NT 3.1 or later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Advapi32.lib.
Access Control Overview, Access Control Functions, Well-Known SIDs, FreeSid, GetSidIdentifierAuthority, InitializeSid, SID_IDENTIFIER_AUTHORITY