--- trunk/RomCheater/Docking/FloatingPEViewer.cs 2013/06/03 05:48:41 470 +++ trunk/RomCheater/Docking/FloatingPEViewer.cs 2013/06/03 07:13:44 471 @@ -20,16 +20,16 @@ { public partial class FloatingPEViewer : DockContent, IAcceptsPlugin, - IAcceptsProcess, + IAcceptsProcess, IAcceptsProcessAndConfig, IAcceptsPEData { - public FloatingPEViewer() { InitializeComponent(); this.AcceptedPlugin = null; this.AcceptedProcess = null; OnPEDataUpdated = null; } + public FloatingPEViewer() { InitializeComponent(); this.AcceptedPlugin = null; this.ProcessPID = 0; OnPEDataUpdated = null; } public FloatingPEViewer(IConfigPlugin config) : this() { this.AcceptedPlugin = config; } - public FloatingPEViewer(IConfigPlugin config, Process process) : this() { this.AcceptedPlugin = config; this.AcceptedProcess = process; } + public FloatingPEViewer(IConfigPlugin config, int pid) : this() { this.AcceptedPlugin = config; this.ProcessPID = pid; } #region IAcceptsProcess Members - private Process _AcceptedProcess; - public Process AcceptedProcess { get { return _AcceptedProcess; } set { _AcceptedProcess = value; UpdateAcceptedProcess(value); } } + private int _ProcessPID; + public int ProcessPID { get { return _ProcessPID; } set { _ProcessPID = value; UpdateProcessPID(value); } } #endregion #region IAcceptsPlugin Members private IConfigPlugin _AcceptedPlugin; @@ -44,7 +44,7 @@ private void UpdateAcceptedPlugin(IConfigPlugin config) { } - private void UpdateAcceptedProcess(Process process) + private void UpdateProcessPID(int pid) { #if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && FORCE_USE_OF_MEMORYSIZECONSTANTS logger.Warn.WriteLine("FloatingMemorySearcher.UpdateAcceptedProcessAndConfig(IConfigPlugin config, Process process):"); @@ -58,16 +58,19 @@ #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) + if (ProcessPID != 0) { - 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)); + 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)); + } } else {