private static NtSection OpenSection(string name, bool read_only)
        {
            SectionAccessRights access = SectionAccessRights.MapRead;

            if (!read_only)
            {
                access |= SectionAccessRights.MapWrite;
            }
            return(NtSection.Open(name, null, access));
        }
Esempio n. 2
0
        public NtMappedSection OpenMappedFile(bool writable)
        {
            SectionAccessRights accessRights = SectionAccessRights.MapRead;

            if (writable)
            {
                accessRights |= SectionAccessRights.MapWrite;
            }

            using (NtSection section = NtSection.DuplicateFrom(_ent.ProcessId, new IntPtr(_ent.Handle), accessRights))
            {
                return(section.Map(writable ? ProtectionType.ReadWrite : ProtectionType.ReadOnly));
            }
        }
Esempio n. 3
0
 public static extern NtStatus NtOpenSection(out SafeKernelObjectHandle SectionHandle,
                                             SectionAccessRights DesiredAccess,
                                             [In] ObjectAttributes ObjectAttributes);
Esempio n. 4
0
 public static extern NtStatus NtCreateSection(out SafeKernelObjectHandle SectionHandle,
                                               SectionAccessRights DesiredAccess,
                                               [In] ObjectAttributes ObjectAttributes, [In] LargeInteger SectionSize,
                                               ProtectionType Protect, SectionAttributes Attributes,
                                               SafeHandle FileHandle);
Esempio n. 5
0
 protected override sealed NtResult <NtSection> OpenInternal(ObjectAttributes obj_attributes,
                                                             SectionAccessRights desired_access, bool throw_on_error)
 {
     return(NtSection.Open(obj_attributes, desired_access, throw_on_error));
 }
 public static extern NtStatus NtCreateSectionEx(out SafeKernelObjectHandle SectionHandle,
                                                 SectionAccessRights DesiredAccess,
                                                 [In] ObjectAttributes ObjectAttributes, [In] LargeInteger SectionSize,
                                                 MemoryAllocationProtect Protect, SectionAttributes Attributes,
                                                 SafeHandle FileHandle,
                                                 MemSectionExtendedParameter[] ExtendedParameters, int ExtendedParameterCount);