Esempio n. 1
0
        public void AddRange(int index, IEnumerable <Ace> aceList)
        {
            int totalSize = 0;

            // Compute the total size, in bytes.
            foreach (Ace ace in aceList)
            {
                totalSize += ace.Size;
            }

            using (MemoryAlloc aceListMemory = new MemoryAlloc(totalSize))
            {
                int i = 0;

                // Copy the ACEs into one contiguous block.
                foreach (Ace ace in aceList)
                {
                    aceListMemory.WriteMemory(i, ace, ace.Size);
                    i += ace.Size;
                }

                // Add the ACEs to the ACL.
                Win32.RtlAddAce(
                    this,
                    Win32.AclRevision,
                    index,
                    aceListMemory,
                    totalSize
                    ).ThrowIf();
            }
        }
Esempio n. 2
0
        public MemoryAlloc ToMemory()
        {
            MemoryAlloc data = new MemoryAlloc(_portMessageSize + _message.DataLength);

            data.WriteStruct <PortMessageStruct>(_message);
            data.WriteMemory(_portMessageSize, _data, _message.DataLength);

            return(data);
        }
Esempio n. 3
0
        public MemoryAlloc ToMemory()
        {
            MemoryAlloc data = new MemoryAlloc(PortMessageStruct.SizeOf + _message.DataLength);

            data.WriteStruct(_message);
            data.WriteMemory(PortMessageStruct.SizeOf, _data, _message.DataLength);

            return(data);
        }
Esempio n. 4
0
        public void AddRange(int index, IEnumerable <Ace> aceList)
        {
            int totalSize = 0;

            // Compute the total size, in bytes.
            foreach (Ace ace in aceList)
            {
                totalSize += ace.Size;
            }

            using (var aceListMemory = new MemoryAlloc(totalSize))
            {
                int i = 0;

                // Copy the ACEs into one contiguous block.
                foreach (Ace ace in aceList)
                {
                    aceListMemory.WriteMemory(i, ace, 0, ace.Size);
                    i += ace.Size;
                }

                NtStatus status;

                // Add the ACEs to the ACL.
                if ((status = Win32.RtlAddAce(
                         this,
                         Win32.AclRevision,
                         index,
                         aceListMemory,
                         totalSize
                         )) >= NtStatus.Error)
                {
                    Win32.ThrowLastError(status);
                }
            }
        }
Esempio n. 5
0
        public MemoryAlloc ToMemory()
        {
            MemoryAlloc data = new MemoryAlloc(_portMessageSize + _message.DataLength);

            data.WriteStruct<PortMessageStruct>(_message);
            data.WriteMemory(_portMessageSize, _data, 0, _message.DataLength);

            return data;
        }
Esempio n. 6
0
        public MemoryAlloc ToMemory()
        {
            MemoryAlloc data = new MemoryAlloc(PortMessageStruct.SizeOf + _message.DataLength);

            data.WriteStruct(_message);
            data.WriteMemory(PortMessageStruct.SizeOf, _data, _message.DataLength);

            return data;
        }