private SecurityInformationImpl(string obj_name,
                                        Dictionary <uint, string> names, GenericMapping generic_mapping,
                                        bool read_only)
        {
            _mapping    = generic_mapping;
            _obj_name   = new SafeStringBuffer(obj_name);
            _access_map = new SafeHGlobalBuffer(Marshal.SizeOf(typeof(SiAccess)) * names.Count);
            SiAccess[] sis         = new SiAccess[names.Count];
            IntPtr     current_ptr = _access_map.DangerousGetHandle();

            _names = new DisposableList <SafeStringBuffer>();
            int i = 0;

            foreach (KeyValuePair <uint, string> pair in names)
            {
                _names.Add(new SafeStringBuffer(pair.Value));
                SiAccess si = new SiAccess
                {
                    pguid   = IntPtr.Zero,
                    dwFlags = SiAccessFlags.SI_ACCESS_SPECIFIC | SiAccessFlags.SI_ACCESS_GENERAL,
                    mask    = pair.Key,
                    pszName = _names[i].DangerousGetHandle()
                };
                sis[i] = si;
                i++;
            }
            _access_map.WriteArray(0, sis, 0, names.Count);
            _read_only = read_only;
        }
 public SecurityInformationImpl(string obj_name, NtObject handle,
     Dictionary<uint, string> names, GenericMapping generic_mapping)
 {
     _mapping = generic_mapping;
     _handle = handle;
     _obj_name = new SafeStringBuffer(obj_name);
     _access_map = new SafeHGlobalBuffer(Marshal.SizeOf(typeof(SiAccess)) * names.Count);
     SiAccess[] sis = new SiAccess[names.Count];
     IntPtr current_ptr = _access_map.DangerousGetHandle();
     _names = new DisposableList<SafeStringBuffer>();
     int i = 0;
     foreach (KeyValuePair<uint, string> pair in names)
     {
         _names.Add(new SafeStringBuffer(pair.Value));
         SiAccess si = new SiAccess();
         si.dwFlags = SiAccessFlags.SI_ACCESS_SPECIFIC | SiAccessFlags.SI_ACCESS_GENERAL;
         si.mask = pair.Key;
         si.pszName = _names[i].DangerousGetHandle();
         sis[i] = si;
         i++;
     }
     _access_map.WriteArray(0, sis, 0, names.Count);
 }