CreateWellKnownSid function (securitybaseapi.h)

The CreateWellKnownSid function creates a SID for predefined aliases.


BOOL CreateWellKnownSid(
  [in]            WELL_KNOWN_SID_TYPE WellKnownSidType,
  [in, optional]  PSID                DomainSid,
  [out, optional] PSID                pSid,
  [in, out]       DWORD               *cbSid


[in] WellKnownSidType

Member of the WELL_KNOWN_SID_TYPE enumeration that specifies what the SID will identify.

[in, optional] DomainSid

A pointer to a SID that identifies the domain to use when creating the SID. Pass NULL to use the local computer.

[out, optional] pSid

A pointer to memory where CreateWellKnownSid will store the new SID.

[in, out] cbSid

A pointer to a DWORD that contains the number of bytes available at pSid. The CreateWellKnownSid function stores the number of bytes actually used at this location.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. For extended error information, call GetLastError.


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