/[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 154 by william, Mon May 28 03:04:05 2012 UTC revision 164 by william, Mon May 28 07:49:48 2012 UTC
# Line 9  using System.Windows.Forms; Line 9  using System.Windows.Forms;
9  using WeifenLuo.WinFormsUI.Docking;  using WeifenLuo.WinFormsUI.Docking;
10  using RomCheater.PluginFramework.Interfaces;  using RomCheater.PluginFramework.Interfaces;
11  using System.Diagnostics;  using System.Diagnostics;
12    using System.IO;
13    using RomCheater.Logging;
14    using System.Reflection;
15    
16  namespace RomCheater.Docking  namespace RomCheater.Docking
17  {  {
# Line 137  namespace RomCheater.Docking Line 140  namespace RomCheater.Docking
140                      break;                      break;
141              }              }
142          }          }
143    
144            private void btnDumpRam_Click(object sender, EventArgs e)
145            {
146                if (this.AcceptedProcess == null)
147                {
148                    MessageBox.Show("Please select a process to dump memory from", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
149                    return;
150                }
151                DialogResult result = dumpsaver.ShowDialog();
152                if (result != DialogResult.OK) return;
153                DumpRam(txtStart.Value, txtEnd.Value, dumpsaver.FileName);
154            }
155    
156    
157            #region memory support
158            private void DumpRam(ulong start, ulong end, string filename)
159            {
160                uint byte_count = (uint)(end - start);
161    
162                //string arch = ProcessorAssemblyArchitecture.GetProcessorArchitecture(typeof(FloatingRamDumperDialog).Assembly);
163                //if (arch == ProcessorAssemblyArchitecture.x86)
164                //{
165                    if (end > int.MaxValue)
166                        logger.Warn.WriteLine("Warning: DumpRam(): ending address is greater than 0x{0:x8} and we are running x86, this will exceed the ", int.MaxValue);                
167                //}
168                //else if (arch == ProcessorAssemblyArchitecture.x64)
169                //{
170                //}
171                //else
172                //{
173                //    // don't know
174                //}
175    
176                DumpRam(start, byte_count, filename);
177            }
178            private void DumpRam(ulong start, uint count, string filename)
179            {
180                if (this.AcceptedProcess == null) return;
181                Sojaner.MemoryScanner.ProcessMemoryReader reader = new Sojaner.MemoryScanner.ProcessMemoryReader();
182                reader.ReadProcess = this.AcceptedProcess;
183                reader.OpenProcess();
184                int bytesReadSize;
185                reader.DumpMemory(filename, (uint)start, count, out bytesReadSize);
186                reader.CloseHandle();            
187            }
188            #endregion
189      }      }
190  }  }

Legend:
Removed from v.154  
changed lines
  Added in v.164

  ViewVC Help
Powered by ViewVC 1.1.22