--- trunk/RomCheater/Docking/FloatingPEViewer.cs 2012/06/05 17:57:37 318 +++ trunk/RomCheater/Docking/FloatingPEViewer.cs 2012/06/19 09:30:48 382 @@ -14,15 +14,17 @@ using RomCheater.PluginFramework.Interfaces; using System.Diagnostics; using Sojaner.MemoryScanner; +using RomCheater.PluginFramework.Events; namespace RomCheater.Docking { public partial class FloatingPEViewer : DockContent, IAcceptsPlugin, IAcceptsProcess, - IAcceptsProcessAndConfig + IAcceptsProcessAndConfig, + IAcceptsPEData { - public FloatingPEViewer() { InitializeComponent(); this.AcceptedPlugin = null; this.AcceptedProcess = null; } + public FloatingPEViewer() { InitializeComponent(); this.AcceptedPlugin = null; this.AcceptedProcess = null; OnPEDataUpdated = null; } public FloatingPEViewer(IConfigPlugin config) : this() { this.AcceptedPlugin = config; } public FloatingPEViewer(IConfigPlugin config, Process process) : this() { this.AcceptedPlugin = config; this.AcceptedProcess = process; } #region IAcceptsProcess Members @@ -33,8 +35,10 @@ private IConfigPlugin _AcceptedPlugin; public IConfigPlugin AcceptedPlugin { get { return _AcceptedPlugin; } set { _AcceptedPlugin = value; UpdateAcceptedPlugin(value); } } #endregion - - int MemoryRangeStart { get; set; } + #region IAcceptsPEData Members + public event BaseEventHandler OnPEDataUpdated; + #endregion + uint MemoryRangeStart { get; set; } uint MemoryRangeSize { get; set; } private void UpdateAcceptedPlugin(IConfigPlugin config) @@ -50,22 +54,25 @@ #if FORCE_USE_OF_MEMORYSIZECONSTANTS // force use of MemorySizeConstants MemoryRangeStart = MemorySizeConstants.MinimumAddress; - MemoryRangeSizee = (MemorySizeConstants.MinimumAddress > 0) ? (uint)(MemorySizeConstants.MaximumAddress - MemorySizeConstants.MinimumAddress) : MemorySizeConstants.MaximumAddress; + MemoryRangeSize = MemoryRangeStart + MemorySizeConstants.MaximumAddressSize; #endif #if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && !FORCE_USE_OF_MEMORYSIZECONSTANTS //// code to automatically choose the best starting memory address and size if (process != null) { string filename = process.MainModule.FileName; - //string filename = @"c:\Windows\notepad.exe"; - PEReader peReader = new PEReader(filename); - peprops.SelectedObject = peReader.GetData; + //string filename = @"c:\Windows\notepad.exe"; + IPEDData peData = PEDataWrapper.GetPEData((IAcceptsProcessAndConfig)this); + peprops.SelectedObject = peData; peprops.PropertySort = PropertySort.NoSort; + if (OnPEDataUpdated != null) + if (peData != null) + OnPEDataUpdated(new PEViewerDataUpdatedEvent(this, peData)); } else { MemoryRangeStart = MemorySizeConstants.MinimumAddress; - MemoryRangeSize = (MemorySizeConstants.MinimumAddress > 0) ? (uint)(MemorySizeConstants.MaximumAddress - MemorySizeConstants.MinimumAddress) : MemorySizeConstants.MaximumAddress; + MemoryRangeSize = MemorySizeConstants.MaximumAddressSize; } #endif