The methods Task.GetSecurityDescriptorSddlForm and Task.SetSecurityDescriptorSddlForm accept a parameter of type AccessControlSections. The value of this parameter is passed to [IRegisteredTask::GetSecurityDescriptor](http://msdn.microsoft.com/en-us/library/windows/desktop/aa380760(v=vs.85).aspx) and [IRegisteredTask::SetSecurityDescriptor](http://msdn.microsoft.com/en-us/library/windows/desktop/aa380769(v=vs.85).aspx) respectively. This results in incorrect behavior.
[IRegisteredTask::GetSecurityDescriptor](http://msdn.microsoft.com/en-us/library/windows/desktop/aa380760(v=vs.85).aspx) expects a [SECURITY_INFORMATION](http://msdn.microsoft.com/en-us/library/windows/desktop/aa379573(v=vs.85).aspx) data type which does not align with [AccessControlSections](http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.accesscontrolsections(v=vs.110).aspx). For example, passing AccessControlSettings.Audit to this method results in the Owner part being returned.
The documentation for [IRegisteredTask::SetSecurityDescriptor](http://msdn.microsoft.com/en-us/library/windows/desktop/aa380769(v=vs.85).aspx) indicates that the TASK_DONT_ADD_PRINCIPAL_ACE flag from the [TASK_CREATION](http://msdn.microsoft.com/en-us/library/windows/desktop/aa382538(v=vs.85).aspx) enumeration can be specified for the second parameter.
Comments: ** Comment from web user: RobV8R **
[IRegisteredTask::GetSecurityDescriptor](http://msdn.microsoft.com/en-us/library/windows/desktop/aa380760(v=vs.85).aspx) expects a [SECURITY_INFORMATION](http://msdn.microsoft.com/en-us/library/windows/desktop/aa379573(v=vs.85).aspx) data type which does not align with [AccessControlSections](http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.accesscontrolsections(v=vs.110).aspx). For example, passing AccessControlSettings.Audit to this method results in the Owner part being returned.
The documentation for [IRegisteredTask::SetSecurityDescriptor](http://msdn.microsoft.com/en-us/library/windows/desktop/aa380769(v=vs.85).aspx) indicates that the TASK_DONT_ADD_PRINCIPAL_ACE flag from the [TASK_CREATION](http://msdn.microsoft.com/en-us/library/windows/desktop/aa382538(v=vs.85).aspx) enumeration can be specified for the second parameter.
Comments: ** Comment from web user: RobV8R **
A better example of the problem:
```
task.GetSecurityDescriptorSddlForm(AccessControlSections.Owner);
```
Should return:
```
O:BA
```
Instead, it returns:
```
D:AI(A;;FR;;;S-1-5-21... (etc)
```
As previously mentioned, this is because the value of AccessControlSections is being passed to IRegisteredTask::GetSecurityDescriptor when a SECURITY_INFORMATION should have been used instead.