#ifndef _NTRTL_H
/**
* The RtlAllocateAndInitializeSid routine allocates and initializes a security identifier (SID) with up to eight subauthorities.
*
* \param IdentifierAuthority A pointer to the SID_IDENTIFIER_AUTHORITY for the new SID.
* \param SubAuthorityCount The number of subauthorities to place in the SID.
* \param SubAuthority0 The first subauthority value.
* \param SubAuthority1 The second subauthority value.
* \param SubAuthority2 The third subauthority value.
* \param SubAuthority3 The fourth subauthority value.
* \param SubAuthority4 The fifth subauthority value.
* \param SubAuthority5 The sixth subauthority value.
* \param SubAuthority6 The seventh subauthority value.
* \param SubAuthority7 The eighth subauthority value.
* \param Sid A pointer to a variable that receives the allocated SID.
* \return NTSTATUS Successful or errant status.
* \sa https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlallocateandinitializesid
* \remarks The fixed-argument form supports 0 through 8 subauthorities and returns STATUS_INVALID_SID for a larger count before allocating. Output is published only after successful allocation/initialization; release it with RtlFreeSid.
*/
_Must_inspect_result_
NTSYSAPI
NTSTATUS
NTAPI
RtlAllocateAndInitializeSid(
_In_ PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
_In_ UCHAR SubAuthorityCount,
_In_ ULONG SubAuthority0,
_In_ ULONG SubAuthority1,
_In_ ULONG SubAuthority2,
_In_ ULONG SubAuthority3,
_In_ ULONG SubAuthority4,
_In_ ULONG SubAuthority5,
_In_ ULONG SubAuthority6,
_In_ ULONG SubAuthority7,
_Outptr_ PSID *Sid
);
View code on GitHub// ntifs.h
NTSYSAPI NTSTATUS RtlAllocateAndInitializeSid(
PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
UCHAR SubAuthorityCount,
ULONG SubAuthority0,
ULONG SubAuthority1,
ULONG SubAuthority2,
ULONG SubAuthority3,
ULONG SubAuthority4,
ULONG SubAuthority5,
ULONG SubAuthority6,
ULONG SubAuthority7,
PSID *Sid
);
View the official Windows Driver Kit DDI referenceThis function is documented in Windows Driver Kit.
The RtlAllocateAndInitializeSid routine is reserved for system use. See RtlCopySid and RtlInitializeSid.
IdentifierAuthorityReserved.
SubAuthorityCountReserved.
SubAuthority0Reserved.
SubAuthority1Reserved.
SubAuthority2Reserved.
SubAuthority3Reserved.
SubAuthority4Reserved.
SubAuthority5Reserved.
SubAuthority6Reserved.
SubAuthority7Reserved.
SidReserved.
Reserved.