コード例 #1
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));
            }
        }
コード例 #2
0
 private void openNamedSectionToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (NamedObjectForm frm = new NamedObjectForm("Section"))
     {
         if (frm.ShowDialog(this) == DialogResult.OK)
         {
             using (NtSection handle = (NtSection)frm.ObjectHandle)
             {
                 NtMappedSection   mapped_file = handle.Map(frm.ReadOnly ? MemoryAllocationProtect.ReadOnly : MemoryAllocationProtect.ReadWrite);
                 SectionEditorForm c           = new SectionEditorForm(mapped_file, frm.ObjectName, frm.ReadOnly);
                 c.Show(dockPanel, DockState.Document);
             }
         }
     }
 }