Click to Rate and Give Feedback
MSDN
MSDN Library
Security
Authorization
 AllocateAndInitializeSid Function

  Switch on low bandwidth view
AllocateAndInitializeSid Function

The AllocateAndInitializeSid function allocates and initializes a security identifier (SID) with up to eight subauthorities.

Syntax

C++
BOOL WINAPI AllocateAndInitializeSid(
  __in   PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
  __in   BYTE nSubAuthorityCount,
  __in   DWORD dwSubAuthority0,
  __in   DWORD dwSubAuthority1,
  __in   DWORD dwSubAuthority2,
  __in   DWORD dwSubAuthority3,
  __in   DWORD dwSubAuthority4,
  __in   DWORD dwSubAuthority5,
  __in   DWORD dwSubAuthority6,
  __in   DWORD dwSubAuthority7,
  __out  PSID *pSid
);

Parameters

pIdentifierAuthority [in]

A pointer to a SID_IDENTIFIER_AUTHORITY structure. This structure provides the top-level identifier authority value to set in the SID.

nSubAuthorityCount [in]

Specifies the number of subauthorities to place in the SID. This parameter also identifies how many of the subauthority parameters have meaningful values. This parameter must contain a value from 1 to 8.

For example, a value of 3 indicates that the subauthority values specified by the dwSubAuthority0, dwSubAuthority1, and dwSubAuthority2 parameters have meaningful values and to ignore the remainder.

dwSubAuthority0 [in]

Subauthority value to place in the SID.

dwSubAuthority1 [in]

Subauthority value to place in the SID.

dwSubAuthority2 [in]

Subauthority value to place in the SID.

dwSubAuthority3 [in]

Subauthority value to place in the SID.

dwSubAuthority4 [in]

Subauthority value to place in the SID.

dwSubAuthority5 [in]

Subauthority value to place in the SID.

dwSubAuthority6 [in]

Subauthority value to place in the SID.

dwSubAuthority7 [in]

Subauthority value to place in the SID.

pSid [out]

A pointer to a variable that receives the pointer to the allocated and initialized SID structure.

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

A SID allocated with the AllocateAndInitializeSid function must be freed by using the FreeSid function.

This function creates a SID with a 32-bit RID value. For applications that require longer RID values, use CreateWellKnownSid.

Examples

For an example that uses this function, see Creating a Security Descriptor for a New Object or Taking Object Ownership.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll

See Also

Access Control
Basic Access Control Functions
Well-known SIDs
FreeSid
GetSidIdentifierAuthority
InitializeSid
SID_IDENTIFIER_AUTHORITY

Send comments about this topic to Microsoft

Build date: 6/26/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker