AllocateAndInitializeSid

  BOOL AllocateAndInitializeSid(pIdentifierAuthority, nSubAuthorityCount, nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3, nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, pSid)    
  PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority;    
  BYTE nSubAuthorityCount;    
  DWORD nSubAuthority0;    
  DWORD nSubAuthority1;    
  DWORD nSubAuthority2;    
  DWORD nSubAuthority3;    
  DWORD nSubAuthority4;    
  DWORD nSubAuthority5;    
  DWORD nSubAuthority6;    
  DWORD nSubAuthority7;    
  PSID *pSid;    

The AllocateAndInitializeSid function allocates and initializes a security identifier (SID) with the specified number of sub-authorities (up to 8). A SID allocated with this function must be freed using the FreeSid function.

Parameters

pIdentifierAuthority

Pointer to the Identifier Authority value to set in the SID.

nSubAuthorityCount

The number of sub-authorities to place in the SID. This also identifies how many of the SubAuthorityN parameters have meaningful values. This must contain a value from 0 through 8.

nSubAuthority0 through nSubAuthority7

Provides the corresponding sub-authority value to place in the SID. For example, a SubAuthorityCount value of 3 indicates that SubAuthority0, SubAuthority1, and SubAuthority0 have meaningful values and the rest are to be ignored.

Sid

Receives a pointer to the allocated and initialized SID data structure.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. To obtain extended error information, use the GetLastError function.

See Also

FreeSid