Reading the defaultSecurityDescriptor for an Object Class
Using ADSI, you can read the defaultSecurityDescriptor for an object class.
To read the defaultSecurityDescriptor for an Object Class in C/C++
If you are using ADSI, use the following steps for reading defaultSecurityDescriptor for an object class (see the following code fragment for an example):
- Get an IADs interface pointer to the classSchema object for the object class.
- Use the IADs::Get method to get the default security descriptor of the object. The name of the property containing the security descriptor is defaultSecurityDescriptor. The property will be returned as a VARIANT containing a BSTR with the default security descriptor in SDDL string format.
- Use the ConvertStringSecurityDescriptorToSecurityDescriptor function to convert the SDDL string form to a security descriptor.
- Use the Win32 Security APIs to read the parts of the security descriptor: GetSecurityDescriptorDacl, GetSecurityDescriptorSacl, GetSecurityDescriptorOwner, and GetSecurityDescriptorControl.