setsecuritydescriptordacl (advapi32)
Last changed: -81.95.21.122

.
Summary
Sets information in a discretionary access control list (DACL)

C# Signature:

[DllImport("advapi32.dll", SetLastError=true)]
static extern bool SetSecurityDescriptorDacl(ref SECURITY_DESCRIPTOR sd, bool daclPresent, IntPtr dacl, bool daclDefaulted);

VB Signature:

<DllImportAttribute("advapi32.dll", EntryPoint:="SetSecurityDescriptorDacl")>

Private Shared Function SetSecurityDescriptorDacl(ByRef pSecurityDescriptor As SECURITY_DESCRIPTOR, <MarshalAsAttribute(UnmanagedType.Bool)> ByVal bDaclPresent As Boolean, <InAttribute()> ByVal pDacl As System.IntPtr, <MarshalAsAttribute(UnmanagedType.Bool)> ByVal bDaclDefaulted As Boolean) As UInteger

End Function

User-Defined Types:

SECURITY_DESCRIPTOR

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

// Initialize the security descriptor structure
SECURITY_DESCRIPTOR securityDesc = new SECURITY_DESCRIPTOR();
InitializeSecurityDescriptor(out securityDesc, 1);
SetSecurityDescriptorDacl(ref securityDesc, true, IntPtr.Zero, false);

Documentation