Skip to content

Latest commit

 

History

History
180 lines (103 loc) · 8.47 KB

nf-aclapi-buildsecuritydescriptorw.md

File metadata and controls

180 lines (103 loc) · 8.47 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:aclapi.BuildSecurityDescriptorW
BuildSecurityDescriptorW function (aclapi.h)
Allocates and initializes a new security descriptor. (Unicode)
BuildSecurityDescriptor
BuildSecurityDescriptor function [Security]
BuildSecurityDescriptorW
_win32_buildsecuritydescriptor
aclapi/BuildSecurityDescriptor
aclapi/BuildSecurityDescriptorW
security.buildsecuritydescriptor
security\buildsecuritydescriptor.htm
security
becc1218-5bc3-4ab2-86f8-3ebd10e16966
12/05/2018
BuildSecurityDescriptor, BuildSecurityDescriptor function [Security], BuildSecurityDescriptorA, BuildSecurityDescriptorW, _win32_buildsecuritydescriptor, aclapi/BuildSecurityDescriptor, aclapi/BuildSecurityDescriptorA, aclapi/BuildSecurityDescriptorW, security.buildsecuritydescriptor
aclapi.h
Windows
Windows XP [desktop apps only]
Windows Server 2003 [desktop apps only]
BuildSecurityDescriptorW (Unicode) and BuildSecurityDescriptorA (ANSI)
Advapi32.lib
Advapi32.dll
Windows
19H1
BuildSecurityDescriptorW
aclapi/BuildSecurityDescriptorW
c++
APIRef
kbSyntax
DllExport
Advapi32.dll
API-MS-Win-security-trustee-l1-1-0.dll
advapi32legacy.dll
API-MS-Win-security-trustee-l1-1-1.dll
BuildSecurityDescriptor
BuildSecurityDescriptorA
BuildSecurityDescriptorW

BuildSecurityDescriptorW function

-description

The BuildSecurityDescriptor function allocates and initializes a new security descriptor. This function can initialize the new security descriptor by merging specified security information with the information in an existing security descriptor. If you do not specify an existing security descriptor, the function initializes a new security descriptor based on the specified security information.

The BuildSecurityDescriptor function creates a self-relative security descriptor. The self-relative format makes the security descriptor suitable for storing in a stream.

-parameters

-param pOwner [in, optional]

A pointer to a TRUSTEE structure that identifies the owner for the new security descriptor. If the structure uses the TRUSTEE_IS_NAME form, BuildSecurityDescriptor looks up the security identifier (SID) associated with the specified trustee name.

If this parameter is NULL, the function uses the owner SID from the original security descriptor pointed to by pOldSD. If pOldSD is NULL, or if the owner SID in pOldSD is NULL, the owner SID is NULL in the new security descriptor.

-param pGroup [in, optional]

A pointer to a TRUSTEE structure that identifies the primary group SID for the new security descriptor. If the structure uses the TRUSTEE_IS_NAME form, BuildSecurityDescriptor looks up the SID associated with the specified trustee name.

If this parameter is NULL, the function uses the group SID from the original security descriptor pointed to by pOldSD. If pOldSD is NULL, or if the group SID in pOldSD is NULL, the group SID is NULL in the new security descriptor.

-param cCountOfAccessEntries [in]

The number of EXPLICIT_ACCESS structures in the pListOfAccessEntries array.

-param pListOfAccessEntries [in, optional]

A pointer to an array of EXPLICIT_ACCESS structures that describe access control information for the discretionary access control list (DACL) of the new security descriptor. The function creates the new DACL by merging the information in the array with the DACL in pOldSD, if any. If pOldSD is NULL, or if the DACL in pOldSD is NULL, the function creates a new DACL based solely on the information in the array. For a description of the rules for creating an ACL from an array of EXPLICIT_ACCESS structures, see the SetEntriesInAcl function.

If pListOfAccessEntries is NULL, the new security descriptor gets the DACL from pOldSD. In this case, if pOldSD is NULL, or if the DACL in pOldSD is NULL, the new DACL is NULL.

-param cCountOfAuditEntries [in]

The number of EXPLICIT_ACCESS structures in the pListOfAuditEntries array.

-param pListOfAuditEntries [in, optional]

A pointer to an array of EXPLICIT_ACCESS structures that describe audit control information for the SACL of the new security descriptor. The function creates the new SACL by merging the information in the array with the SACL in pOldSD, if any. If pOldSD is NULL, or the SACL in pOldSD is NULL, the function creates a new SACL based solely on the information in the array.

If pListOfAuditEntries is NULL, the new security descriptor gets the SACL from pOldSD. In this case, if pOldSD is NULL, or the SACL in pOldSD is NULL, the new SACL is NULL.

-param pOldSD [in, optional]

A pointer to an existing self-relative SECURITY_DESCRIPTOR structure and its associated security information. The function builds the new security descriptor by merging the specified owner, group, access control, and audit-control information with the information in this security descriptor. This parameter can be NULL.

-param pSizeNewSD [out]

A pointer to a variable that receives the size, in bytes, of the security descriptor.

-param pNewSD [out]

A pointer to a variable that receives a pointer to the new security descriptor. The function allocates memory for the new security descriptor. You must call the LocalFree function to free the returned buffer.

-returns

If the function succeeds, the function returns ERROR_SUCCESS.

If the function fails, it returns a nonzero error code defined in WinError.h.

-remarks

The BuildSecurityDescriptor function is intended for trusted servers that implement or expose security on their own objects. The function uses self-relative security descriptors suitable for serializing into a stream and storing to disk, as a trusted server might require.

Note

The aclapi.h header defines BuildSecurityDescriptor as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

ACL

Client/Server Access Control Functions

Client/Server Access Control Overview

EXPLICIT_ACCESS

LocalFree

SECURITY_DESCRIPTOR

SID

SetEntriesInAcl

TRUSTEE