SECURITY_ATTRIBUTES (Structures)
Last changed: -67.168.202.202

.
Summary

C# Definition:

[StructLayout(LayoutKind.Sequential)]
public struct SECURITY_ATTRIBUTES
{
    public int nLength;
    public IntPtr lpSecurityDescriptor;
    public int bInheritHandle;    // BOOL
}

VB Definition:

Structure SECURITY_ATTRIBUTES
   Public TODO
End Structure

User-Defined Field Types:

None.

Notes:

Sample
Creating a semaphore with a NULL DACL (allowing full access to everyone)

SECURITY_DESCRIPTOR sd = new SECURITY_DESCRIPTOR();
InitializeSecurityDescriptor(ref sd, 1);
SetSecurityDescriptorDacl(ref sd, 1, IntPtr.Zero, 0);
GCHandle sdHandle = GCHandle.Alloc(sd, GCHandleType.Pinned);
try
{
    SECURITY_ATTRIBUTES sa = new SECURITY_ATTRIBUTES();
    sa.nLength = Marshal.SizeOf(sa);
    sa.lpSecurityDescriptor = sdHandle.AddrOfPinnedObject();
    sa.bInheritHandle = 0;

    this.Handle = CreateSemaphore(ref sa, 0, int.MaxValue, name);
    if (Handle.ToInt32() == 0)
    {
        int errNo = (int) GetLastError();
        throw new Win32Exception(errNo , "Error " + errNo + " creating semaphore " + name);
    }
}
finally
{
    sdHandle.Free();
}

Documentation