/[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	2012/06/03 12:48:09	237
+++ trunk/RomCheater/Docking/FloatingRamDumperDialog.cs	2012/06/03 12:48:38	238
@@ -12,10 +12,11 @@
 using System.IO;
 using RomCheater.Logging;
 using System.Reflection;
+using Sojaner.MemoryScanner.MemoryProviers;
 
 namespace RomCheater.Docking
 {
-    public partial class FloatingRamDumperDialog : DockContent, IProcessConfig, IAcceptsPlugin<IConfigPlugin>
+    public partial class FloatingRamDumperDialog : DockContent, IAcceptsProcess<Process>, IAcceptsPlugin<IConfigPlugin>
     {
         #region sub-classes
         private const int BYTE_CORRECTION_VALUE = 23;
@@ -40,7 +41,7 @@
         }
 
 
-        #region IProcessConfig Members
+        #region  IAcceptsProcess<Process> Members
         public Process AcceptedProcess { get; set; }
         #endregion
         #region IAcceptsPlugin<IConfigPlugin> Members
@@ -160,20 +161,17 @@
         }
         private void DumpRam(ulong start, uint count, string filename)
         {
-            if (this.AcceptedProcess == null) return;
-            Sojaner.MemoryScanner.ProcessMemoryReader reader = new Sojaner.MemoryScanner.ProcessMemoryReader();
-            reader.ReadProcess = this.AcceptedProcess;
-            reader.OpenProcess();
+            if (this.AcceptedProcess == null) return;            
+            GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this);
             int bytesReadSize;
-            if (reader.WriteProcessMemoryToFile(filename, (uint)start, count, out bytesReadSize))
+            if (provider.WriteProcessMemoryToFile(filename, (uint)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);
             }
             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);
-            }
-            reader.CloseHandle();            
+            }        
         }
         #endregion
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22