public static SECURITY_DESCRIPTOR StringToSecurityDescriptor(string strSD) { SECURITY_DESCRIPTOR StringToSecurityDescriptorRet = default; MemPtr ptr = IntPtr.Zero; uint ls = 0U; SECURITY_DESCRIPTOR sd; IntPtr argSecurityDescriptor = ptr; SecurityDescriptor.ConvertStringSecurityDescriptorToSecurityDescriptor(strSD, 1U, ref argSecurityDescriptor, ref ls); sd = ptr.ToStruct <SECURITY_DESCRIPTOR>(); ptr.LocalFree(); StringToSecurityDescriptorRet = sd; return(StringToSecurityDescriptorRet); }