--- trunk/RomCheater/Docking/FloatingPEViewer.cs 2013/06/03 07:13:44 471 +++ trunk/RomCheater/Docking/FloatingPEViewer.cs 2013/06/06 09:12:35 587 @@ -20,16 +20,17 @@ { public partial class FloatingPEViewer : DockContent, IAcceptsPlugin, - IAcceptsProcess, + IAcceptsProcess, IAcceptsProcessAndConfig, + IAcceptPEData, IAcceptsPEData { - public FloatingPEViewer() { InitializeComponent(); this.AcceptedPlugin = null; this.ProcessPID = 0; OnPEDataUpdated = null; } + public FloatingPEViewer() { InitializeComponent(); this.AcceptedPlugin = null; this.AcceptedProcess = null; OnPEDataUpdated = null; } public FloatingPEViewer(IConfigPlugin config) : this() { this.AcceptedPlugin = config; } - public FloatingPEViewer(IConfigPlugin config, int pid) : this() { this.AcceptedPlugin = config; this.ProcessPID = pid; } + public FloatingPEViewer(IConfigPlugin config, Process process) : this() { this.AcceptedPlugin = config; this.AcceptedProcess = process; } #region IAcceptsProcess Members - private int _ProcessPID; - public int ProcessPID { get { return _ProcessPID; } set { _ProcessPID = value; UpdateProcessPID(value); } } + private Process _AcceptedProcess; + public Process AcceptedProcess { get { return _AcceptedProcess; } set { _AcceptedProcess = value; UpdateAcceptedProcess(value); } } #endregion #region IAcceptsPlugin Members private IConfigPlugin _AcceptedPlugin; @@ -38,13 +39,13 @@ #region IAcceptsPEData Members public event BaseEventHandler OnPEDataUpdated; #endregion - uint MemoryRangeStart { get; set; } - uint MemoryRangeSize { get; set; } + ulong MemoryRangeStart { get; set; } + ulong MemoryRangeSize { get; set; } private void UpdateAcceptedPlugin(IConfigPlugin config) { } - private void UpdateProcessPID(int pid) + private void UpdateAcceptedProcess(Process process) { #if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && FORCE_USE_OF_MEMORYSIZECONSTANTS logger.Warn.WriteLine("FloatingMemorySearcher.UpdateAcceptedProcessAndConfig(IConfigPlugin config, Process process):"); @@ -58,19 +59,16 @@ #endif #if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && !FORCE_USE_OF_MEMORYSIZECONSTANTS //// code to automatically choose the best starting memory address and size - if (ProcessPID != 0) + if (process != null) { - using (Process p = Process.GetProcessById(ProcessPID)) - { - string filename = p.MainModule.FileName; - //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 PEViewerDataUpdatedEventArgs(this, peData)); - } + string filename = process.MainModule.FileName; + //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 PEViewerDataUpdatedEventArgs(this, peData)); } else {