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

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

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

--- trunk/RomCheater/Docking/FloatingRamDumperDialog.cs	2013/06/03 05:48:41	470
+++ trunk/RomCheater/Docking/FloatingRamDumperDialog.cs	2013/06/03 07:13:44	471
@@ -27,12 +27,13 @@
 using System.Reflection;
 using Sojaner.MemoryScanner.MemoryProviers;
 using Sojaner.MemoryScanner;
+using libWin32.Win32.Threading;
 
 namespace RomCheater.Docking
 {
     public partial class FloatingRamDumperDialog : DockContent, 
         IAcceptsPlugin<IConfigPlugin>,
-        IAcceptsProcess<Process>,
+        IAcceptsProcess,
         IAcceptsProcessAndConfig
     {
         #region sub-classes
@@ -47,9 +48,9 @@
         #endregion
         private DumpSize dumpSize = DumpSize.Bytes;
 
-        public FloatingRamDumperDialog() { InitializeComponent(); this.AcceptedPlugin = null; this.AcceptedProcess = null; }
+        public FloatingRamDumperDialog() { InitializeComponent(); this.AcceptedPlugin = null; this.ProcessPID = 0; }
         public FloatingRamDumperDialog(IConfigPlugin config) : this() { this.AcceptedPlugin = config; }
-        public FloatingRamDumperDialog(IConfigPlugin config, Process process) : this() { this.AcceptedPlugin = config; this.AcceptedProcess = process; }
+        public FloatingRamDumperDialog(IConfigPlugin config, int pid) : this() { this.AcceptedPlugin = config; this.ProcessPID = pid; }
        
         private void FloatingRamDumperDialog_Load(object sender, EventArgs e)
         {
@@ -59,7 +60,7 @@
 
 
         #region  IAcceptsProcess<Process> Members
-        public Process AcceptedProcess { get; set; }
+        public int ProcessPID { get; set; }
         #endregion
         #region IAcceptsPlugin<IConfigPlugin> Members
         public IConfigPlugin AcceptedPlugin { get; set; }
@@ -142,7 +143,7 @@
         }
         private void btnDumpRam_Click(object sender, EventArgs e)
         {
-            if (this.AcceptedProcess == null)
+            if (this.ProcessPID == 0)
             {
                 MessageBox.Show("Please select a process to dump memory from", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
@@ -194,18 +195,18 @@
         }
         private void DumpRam(long start, uint count, string filename)
         {
-            if (this.AcceptedProcess == null) return;    
+            if (this.ProcessPID == 0) return;    
             int bytesReadSize;
             using (GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
             {
                 provider.OpenProvider();
                 if (provider.WriteProcessMemoryToFile(filename, (int)start, count, out bytesReadSize))
                 {
-                    MessageBox.Show(string.Format("Succefully dumped memory (0x{0:x8}-0x{1:x8}) from pid=({3}) to file {2}", start, start + count, filename, string.Format("0x{0:x4} {1}.exe", this.AcceptedProcess.Id, AcceptedProcess.ProcessName)), "", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    MessageBox.Show(string.Format("Succefully dumped memory (0x{0:x8}-0x{1:x8}) from pid=({3}) to file {2}", start, start + count, filename, string.Format("0x{0:x4} {1}.exe", this.ProcessPID, ProcessUtils.ProcessName(this.ProcessPID))), "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
-                    MessageBox.Show(string.Format("Failed to dump memory (0x{0:x8}-0x{1:x8}) from pid=({3}) to file {2}", start, start + count, filename, string.Format("0x{0:x4} {1}.exe", this.AcceptedProcess.Id, AcceptedProcess.ProcessName)), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                    MessageBox.Show(string.Format("Failed to dump memory (0x{0:x8}-0x{1:x8}) from pid=({3}) to file {2}", start, start + count, filename, string.Format("0x{0:x4} {1}.exe", this.ProcessPID, ProcessUtils.ProcessName(this.ProcessPID))), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
                 provider.CloseProvider();
             }

 

  ViewVC Help
Powered by ViewVC 1.1.22