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

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

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

--- trunk/RomCheater/Docking/FloatingPEViewer.cs	2012/06/21 18:10:21	408
+++ trunk/RomCheater/Docking/FloatingPEViewer.cs	2013/06/03 07:13:44	471
@@ -20,16 +20,16 @@
 {
     public partial class FloatingPEViewer : DockContent,
         IAcceptsPlugin<IConfigPlugin>,
-        IAcceptsProcess<Process>,
+        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<Process> 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<IConfigPlugin> 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
             {

 

  ViewVC Help
Powered by ViewVC 1.1.22