/[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

revision 198 by william, Thu May 31 07:13:43 2012 UTC revision 238 by william, Sun Jun 3 12:48:38 2012 UTC
# Line 12  using System.Diagnostics; Line 12  using System.Diagnostics;
12  using System.IO;  using System.IO;
13  using RomCheater.Logging;  using RomCheater.Logging;
14  using System.Reflection;  using System.Reflection;
15    using Sojaner.MemoryScanner.MemoryProviers;
16    
17  namespace RomCheater.Docking  namespace RomCheater.Docking
18  {  {
19      public partial class FloatingRamDumperDialog : DockContent, IProcessConfig, IAcceptsPlugin<IConfigPlugin>      public partial class FloatingRamDumperDialog : DockContent, IAcceptsProcess<Process>, IAcceptsPlugin<IConfigPlugin>
20      {      {
21          #region sub-classes          #region sub-classes
22          private const int BYTE_CORRECTION_VALUE = 23;          private const int BYTE_CORRECTION_VALUE = 23;
# Line 40  namespace RomCheater.Docking Line 41  namespace RomCheater.Docking
41          }          }
42    
43    
44          #region IProcessConfig Members          #region  IAcceptsProcess<Process> Members
45          public Process AcceptedProcess { get; set; }          public Process AcceptedProcess { get; set; }
46          #endregion          #endregion
47          #region IAcceptsPlugin<IConfigPlugin> Members          #region IAcceptsPlugin<IConfigPlugin> Members
# Line 160  namespace RomCheater.Docking Line 161  namespace RomCheater.Docking
161          }          }
162          private void DumpRam(ulong start, uint count, string filename)          private void DumpRam(ulong start, uint count, string filename)
163          {          {
164              if (this.AcceptedProcess == null) return;              if (this.AcceptedProcess == null) return;            
165              Sojaner.MemoryScanner.ProcessMemoryReader reader = new Sojaner.MemoryScanner.ProcessMemoryReader();              GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this);
             reader.ReadProcess = this.AcceptedProcess;  
             reader.OpenProcess();  
166              int bytesReadSize;              int bytesReadSize;
167              if (reader.WriteProcessMemoryToFile(filename, (uint)start, count, out bytesReadSize))              if (provider.WriteProcessMemoryToFile(filename, (uint)start, count, out bytesReadSize))
168              {              {
169                  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.AcceptedProcess.Id, AcceptedProcess.ProcessName)), "", MessageBoxButtons.OK, MessageBoxIcon.Information);
170              }              }
171              else              else
172              {              {
173                  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.AcceptedProcess.Id, AcceptedProcess.ProcessName)), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
174              }              }        
             reader.CloseHandle();              
175          }          }
176          #endregion          #endregion
177      }      }

Legend:
Removed from v.198  
changed lines
  Added in v.238

  ViewVC Help
Powered by ViewVC 1.1.22