internal SafeAlpcDataViewBuffer(IntPtr view_base, long view_size, SafeAlpcPortSectionHandle section_handle, AlpcDataViewAttrFlags flags, bool owns_handle) : this(view_base, view_size, owns_handle) { Flags = flags; // If creating a secure buffer then touch all pages. This is IMHO incredibly unintuitive. if (Flags.HasFlag(AlpcDataViewAttrFlags.Secure)) { int page_size = NtSystemInfo.PageSize; long page_count = (view_size + page_size - 1) / page_size; ulong offset = 0; for (long i = 0; i < page_count; ++i) { Write(offset, Read <byte>(offset)); offset += (uint)page_size; } } SectionHandle = section_handle; }
internal AlpcPortSection(AlpcHandle handle, IntPtr size, IntPtr actual_section_size, NtAlpc port) { Handle = new SafeAlpcPortSectionHandle(handle, true, port); Size = size.ToInt64(); ActualSectionSize = actual_section_size.ToInt64(); }