ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater/Docking/FloatingRamDumperDialog.cs
(Generate patch)

Comparing trunk/RomCheater/Docking/FloatingRamDumperDialog.cs (file contents):
Revision 155 by william, Mon May 28 03:04:05 2012 UTC vs.
Revision 156 by william, Mon May 28 04:14:03 2012 UTC

# Line 137 | Line 137 | namespace RomCheater.Docking
137                      break;
138              }
139          }
140 +
141 +        private void btnDumpRam_Click(object sender, EventArgs e)
142 +        {
143 +            if (this.AcceptedProcess == null)
144 +            {
145 +                MessageBox.Show("Please select a process to dump memory from", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
146 +                return;
147 +            }
148 +            DialogResult result = dumpsaver.ShowDialog();
149 +            if (result != DialogResult.OK) return;
150 +            DumpRam(txtStart.Value, txtEnd.Value, dumpsaver.FileName);
151 +        }
152 +
153 +
154 +        #region memory support
155 +        private void DumpRam(ulong start, ulong end, string filename)
156 +        {
157 +            uint byte_count = (uint)(end - start);
158 +            DumpRam(start, byte_count, filename);
159 +        }
160 +        private void DumpRam(ulong start, uint count, string filename)
161 +        {
162 +            if (this.AcceptedProcess == null) return;
163 +            Sojaner.MemoryScanner.ProcessMemoryReader reader = new Sojaner.MemoryScanner.ProcessMemoryReader();
164 +            reader.ReadProcess = this.AcceptedProcess;
165 +            reader.OpenProcess();
166 +            int bytesReadSize;
167 +            byte[] data = reader.ReadProcessMemory((IntPtr)(uint)start, count, out bytesReadSize);
168 +            reader.CloseHandle();
169 +        }
170 +        #endregion
171      }
172   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines