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));
        }
예제 #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));
            }
        }
예제 #3
0
 public static extern NtStatus NtOpenSection(out SafeKernelObjectHandle SectionHandle,
                                             SectionAccessRights DesiredAccess,
                                             [In] ObjectAttributes ObjectAttributes);
예제 #4
0
 public static extern NtStatus NtCreateSection(out SafeKernelObjectHandle SectionHandle,
                                               SectionAccessRights DesiredAccess,
                                               [In] ObjectAttributes ObjectAttributes, [In] LargeInteger SectionSize,
                                               ProtectionType Protect, SectionAttributes Attributes,
                                               SafeHandle FileHandle);
예제 #5
0
파일: NtSection.cs 프로젝트: codehz/winsilo
 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);