Export (0) Print
Expand All
Expand Minimize

SetSecurityDescriptorControl function

The SetSecurityDescriptorControl function sets the control bits of a security descriptor. The function can set only the control bits that relate to automatic inheritance of ACEs. To set the other control bits of a security descriptor, use the functions, such as SetSecurityDescriptorDacl, for modifying the components of a security descriptor.

Syntax


BOOL WINAPI SetSecurityDescriptorControl(
  _In_  PSECURITY_DESCRIPTOR pSecurityDescriptor,
  _In_  SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
  _In_  SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
);

Parameters

pSecurityDescriptor [in]

A pointer to a SECURITY_DESCRIPTOR structure whose control and revision information are set.

ControlBitsOfInterest [in]

A SECURITY_DESCRIPTOR_CONTROL mask that indicates the control bits to set.

ControlBitsToSet [in]

A SECURITY_DESCRIPTOR_CONTROL mask that indicates the new values for the control bits specified by the ControlBitsOfInterest mask.

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

The SetSecurityDescriptorControl function specifies the control bit or bits to modify, and whether the bits are on or off.

Examples

The following example marks the DACL on the security descriptor as protected.


    SetSecurityDescriptorControl( &SecDesc,
            SE_DACL_PROTECTED, SE_DACL_PROTECTED );


The following example marks the DACL as not protected.


    SetSecurityDescriptorControl( &SecDesc,
            SE_DACL_PROTECTED, 0 );


Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Winbase.h (include Windows.h)

Library

Advapi32.lib

DLL

Advapi32.dll

See also

Access Control Overview
Basic Access Control Functions
GetSecurityDescriptorControl
SECURITY_DESCRIPTOR
SECURITY_DESCRIPTOR_CONTROL
SetSecurityDescriptorDacl

 

 

Community Additions

ADD
Show:
© 2014 Microsoft