private static string FormatText(NtHandle ent) { string size = String.Empty; try { using (NtSection section = NtSection.DuplicateFrom(ent.ProcessId, new IntPtr(ent.Handle), SectionAccessRights.Query)) { size = section.Size.ToString(); } } catch (NtException) { size = "Unknown"; } StringBuilder builder = new StringBuilder(); NtType section_type = NtType.GetTypeByName("section"); if (section_type.HasReadPermission(ent.GrantedAccess)) { builder.Append("R"); } if (section_type.HasWritePermission(ent.GrantedAccess)) { builder.Append("W"); } return String.Format("[{0}/0x{0:X}] {1} Size: {2} Access: {3}", ent.Handle, ent.Name, size, builder.ToString()); }
public SectionEditorForm(NtMappedSection map, NtHandle handle, bool readOnly) : this(map, readOnly) { TabText = String.Format("Process {0} - Handle {1} {2}", handle.ProcessId, handle.Handle, _readOnly ? "(RO)" : ""); }
public SectionTreeNode(NtHandle ent) : base(FormatText(ent)) { _ent = ent; }