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; |
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 |
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 |
} |
} |