InitializeSid function (securitybaseapi.h)

The InitializeSid function initializes a security identifier (SID).

Syntax

BOOL InitializeSid(
  [out] PSID                      Sid,
  [in]  PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
  [in]  BYTE                      nSubAuthorityCount
);

Parameters

[out] Sid

A pointer to a SID structure to be initialized.

[in] pIdentifierAuthority

A pointer to a SID_IDENTIFIER_AUTHORITY structure to set in the SID structure.

[in] nSubAuthorityCount

Specifies the number of subauthorities to set in the SID. Values of the subauthority must be set separately, as described in the following Remarks section.

Return value

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.

Remarks

Although the InitializeSid function sets the number of subauthorities for the SID, it does not set the subauthority values. This must be done separately, using functions such as GetSidSubAuthority.

An application can use the AllocateAndInitializeSid function to initialize a SID and set its subauthority values.

This function uses a 32-bit RID value. For applications that require a larger RID value, use CreateWellKnownSid.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header securitybaseapi.h (include Windows.h)
Library Advapi32.lib
DLL Advapi32.dll

See also

Access Control Overview

AllocateAndInitializeSid

Basic Access Control Functions

CreateWellKnownSid

GetLengthSid

GetSidIdentifierAuthority

GetSidLengthRequired

GetSidSubAuthority

GetSidSubAuthorityCount

IsValidSid

SID

SID_IDENTIFIER_AUTHORITY