AllocateSid

Allocates memory for a security identifier (SID) and initializes it with specified values.

Function Declaration

BOOL AllocateSid( _Out_ PSID *pSid );

Parameters

Parameter Type Description
pSid PSID A pointer to a pointer to a SID structure. The function allocates memory for the SID and stores a pointer to it in this variable.

Return Value

If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.

Remarks

The memory allocated by this function must be freed by calling the LocalFree function.

This function allocates memory for a SID and initializes it to a default state. To create a specific SID, you typically need to use other functions such as AllocateSidWithAuthority or AllocateSidWithDomainAccountSid, and then populate the SID's components.

The allocated SID will have a default structure and an empty list of sub-authorities. You will need to use functions like AddIntegrityLabel or manipulate the SID structure directly to assign specific security attributes.

Requirements

Attribute Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target platform Windows
Header winnt.h (include windows.h)
Library Advapi32.lib
DLL Advapi32.dll

See Also