/[RomCheater]/trunk/RomCheater/Docking/FloatingMemorySectionViewer.cs
ViewVC logotype

Diff of /trunk/RomCheater/Docking/FloatingMemorySectionViewer.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater/Docking/FloatingMemorySectionViewer.cs	2013/06/07 11:54:22	601
+++ trunk/RomCheater/Docking/FloatingMemorySectionViewer.cs	2013/06/07 12:11:46	602
@@ -92,6 +92,46 @@
 
             foreach (var region in regions)
             {
+                ListViewItem li = new ListViewItem();
+
+                li.Text =string.Format("0x{0}", region.StartAddress.ToString("X"));
+                li.SubItems.Add(string.Format("0x{0}", region.EndAddress.ToString("X")));
+                li.SubItems.Add(string.Format("0x{0}", region.Size.ToString("X")));
+                li.SubItems.Add(string.Format("{0}", region.RegionInfo.Protect.ToString()));
+                li.SubItems.Add(string.Format("{0}", region.RegionInfo.State.ToString()));
+                li.SubItems.Add(string.Format("{0}", region.RegionInfo.Type.ToString()));
+
+
+                if(region.RegionInfo.Protect == AllocationProtect.PAGE_NOACCESS ||
+                    region.RegionInfo.Protect.HasFlag(AllocationProtect.PAGE_NOACCESS))
+                {
+                    li.ForeColor = Color.Red;
+                }
+
+                else if (region.RegionInfo.Protect == AllocationProtect.PAGE_READONLY ||
+                            region.RegionInfo.Protect.HasFlag(AllocationProtect.PAGE_READONLY) ||
+                            region.RegionInfo.Protect == AllocationProtect.PAGE_EXECUTE_READ ||
+                            region.RegionInfo.Protect.HasFlag(AllocationProtect.PAGE_EXECUTE_READ))
+                {
+                    li.ForeColor = Color.RoyalBlue;
+                }
+                else if (region.RegionInfo.Protect == AllocationProtect.PAGE_READWRITE ||
+                            region.RegionInfo.Protect.HasFlag(AllocationProtect.PAGE_READWRITE) ||
+                            region.RegionInfo.Protect == AllocationProtect.PAGE_EXECUTE_READWRITE ||
+                            region.RegionInfo.Protect.HasFlag(AllocationProtect.PAGE_EXECUTE_READWRITE))
+                {
+                    li.ForeColor = Color.Green;
+                }
+                else if (region.RegionInfo.Protect == AllocationProtect.NONE)
+                {
+                    li.ForeColor = Color.Orange;
+                }
+                else
+                {
+                    li.ForeColor = Color.Black;
+                }
+
+                items.Add(li);
             }
 
             if (items.Count == 0) { return; }
@@ -100,6 +140,12 @@
             lstMemoryRegions.Items.AddRange(items.ToArray());
             lstMemoryRegions.EndUpdate();
 
+
+            foreach (var col in Enumerable.Range(0, lstMemoryRegions.Columns.Count))
+            {
+                lstMemoryRegions.AutoResizeColumn(col, ColumnHeaderAutoResizeStyle.ColumnContent);
+            }
+
         }
 
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22