--- trunk/RomCheater/Docking/FloatingRamDumperDialog.cs 2012/05/28 04:10:38 155 +++ trunk/RomCheater/Docking/FloatingRamDumperDialog.cs 2012/05/28 04:14:03 156 @@ -137,5 +137,36 @@ namespace RomCheater.Docking break; } } + + private void btnDumpRam_Click(object sender, EventArgs e) + { + if (this.AcceptedProcess == null) + { + MessageBox.Show("Please select a process to dump memory from", "", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + DialogResult result = dumpsaver.ShowDialog(); + if (result != DialogResult.OK) return; + DumpRam(txtStart.Value, txtEnd.Value, dumpsaver.FileName); + } + + + #region memory support + private void DumpRam(ulong start, ulong end, string filename) + { + uint byte_count = (uint)(end - start); + DumpRam(start, byte_count, filename); + } + 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(); + int bytesReadSize; + byte[] data = reader.ReadProcessMemory((IntPtr)(uint)start, count, out bytesReadSize); + reader.CloseHandle(); + } + #endregion } } |