/[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 246 by william, Sun Jun 3 15:15:51 2012 UTC revision 249 by william, Sun Jun 3 16:09:05 2012 UTC
# Line 57  namespace RomCheater.Docking Line 57  namespace RomCheater.Docking
57          private void radioBTNGigaBytes_CheckedChanged(object sender, EventArgs e) { dumpSize = DumpSize.GigaBytes; }          private void radioBTNGigaBytes_CheckedChanged(object sender, EventArgs e) { dumpSize = DumpSize.GigaBytes; }
58          private void btnCalcEndAddr_Click(object sender, EventArgs e)          private void btnCalcEndAddr_Click(object sender, EventArgs e)
59          {          {
60              ulong start = 0;              long start = 0;
61              ulong end = 0;              long end = 0;
62              start = txtStart.Value;              start = txtStart.Value;
63              switch (dumpSize)              switch (dumpSize)
64              {              {
65                  case DumpSize.Bytes:                  case DumpSize.Bytes:
66                      end = (ulong)(Convert.ToDouble(txtDumpSize.Text) * 1.0 + (double)start) + BYTE_CORRECTION_VALUE;                      end = (long)(Convert.ToDouble(txtDumpSize.Text) * 1.0 + (double)start) + BYTE_CORRECTION_VALUE;
67                      txtEnd.Value = end;                      txtEnd.Value = end;
68                      break;                      break;
69                  case DumpSize.KiloBytes:                  case DumpSize.KiloBytes:
70                      end = (ulong)(Convert.ToDouble(txtDumpSize.Text) * 1000.0 + (double)start) + BYTE_CORRECTION_VALUE;                      end = (long)(Convert.ToDouble(txtDumpSize.Text) * 1000.0 + (double)start) + BYTE_CORRECTION_VALUE;
71                      txtEnd.Value = end;                      txtEnd.Value = end;
72                      break;                      break;
73                  case DumpSize.MegaBytes:                  case DumpSize.MegaBytes:
74                      end = (ulong)(Convert.ToDouble(txtDumpSize.Text) * 1000000.0 + (double)start) + BYTE_CORRECTION_VALUE;                      end = (long)(Convert.ToDouble(txtDumpSize.Text) * 1000000.0 + (double)start) + BYTE_CORRECTION_VALUE;
75                      txtEnd.Value = end;                      txtEnd.Value = end;
76                      break;                      break;
77                  case DumpSize.GigaBytes:                  case DumpSize.GigaBytes:
78                      end = (ulong)(Convert.ToDouble(txtDumpSize.Text) * 1000000000.0 + (double)start) + BYTE_CORRECTION_VALUE;                      end = (long)(Convert.ToDouble(txtDumpSize.Text) * 1000000000.0 + (double)start) + BYTE_CORRECTION_VALUE;
79                      txtEnd.Value = end;                      txtEnd.Value = end;
80                      break;                      break;
81              }              }
# Line 89  namespace RomCheater.Docking Line 89  namespace RomCheater.Docking
89              {              {
90                  case DumpSize.Bytes:                  case DumpSize.Bytes:
91                      start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1.0)) + BYTE_CORRECTION_VALUE;                      start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1.0)) + BYTE_CORRECTION_VALUE;
92                      txtStart.Value = (ulong)start; ;                      txtStart.Value = (long)start;
93                      break;                      break;
94                  case DumpSize.KiloBytes:                  case DumpSize.KiloBytes:
95                      start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1000.0)) + BYTE_CORRECTION_VALUE;                      start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1000.0)) + BYTE_CORRECTION_VALUE;
96                      txtStart.Value = (ulong)start; ;                      txtStart.Value = (long)start;
97                      break;                      break;
98                  case DumpSize.MegaBytes:                  case DumpSize.MegaBytes:
99                      start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1000000.0)) + BYTE_CORRECTION_VALUE;                      start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1000000.0)) + BYTE_CORRECTION_VALUE;
100                      txtStart.Value = (ulong)start; ;                      txtStart.Value = (long)start;
101                      break;                      break;
102                  case DumpSize.GigaBytes:                  case DumpSize.GigaBytes:
103                      start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1000000000.0)) + BYTE_CORRECTION_VALUE;                      start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1000000000.0)) + BYTE_CORRECTION_VALUE;
104                      txtStart.Value = (ulong)start;                      txtStart.Value = (long)start;
105                      break;                      break;
106              }              }
107          }          }
108          private void btnCalcDumpSize_Click(object sender, EventArgs e)          private void btnCalcDumpSize_Click(object sender, EventArgs e)
109          {          {
110              ulong start = txtStart.Value;              long start = txtStart.Value;
111              ulong end = txtEnd.Value;              long end = txtEnd.Value;
112              ulong byte_diff = (end - start) + BYTE_CORRECTION_VALUE;              long byte_diff = (end - start) + BYTE_CORRECTION_VALUE;
113              switch (dumpSize)              switch (dumpSize)
114              {              {
115                  case DumpSize.Bytes:                  case DumpSize.Bytes:
# Line 140  namespace RomCheater.Docking Line 140  namespace RomCheater.Docking
140          #endregion          #endregion
141    
142          #region memory support          #region memory support
143          private void DumpRam(ulong start, ulong end, string filename)          private void DumpRam(long start, long end, string filename)
144          {          {
145              uint byte_count = (uint)(end - start);              uint byte_count = (uint)(end - start);
146              string arch = ProcessorAssemblyArchitecture.GetProcessorArchitecture(typeof(FloatingRamDumperDialog).Assembly);              string arch = ProcessorAssemblyArchitecture.GetProcessorArchitecture(typeof(FloatingRamDumperDialog).Assembly);
# Line 178  namespace RomCheater.Docking Line 178  namespace RomCheater.Docking
178              }              }
179              DumpRam(start, byte_count, filename);              DumpRam(start, byte_count, filename);
180          }          }
181          private void DumpRam(ulong start, uint count, string filename)          private void DumpRam(long start, uint count, string filename)
182          {          {
183              if (this.AcceptedProcess == null) return;                          if (this.AcceptedProcess == null) return;            
184              GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this);              GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this);
185              provider.OpenProvider();              provider.OpenProvider();
186              int bytesReadSize;              int bytesReadSize;
187              if (provider.WriteProcessMemoryToFile(filename, (uint)start, count, out bytesReadSize))              if (provider.WriteProcessMemoryToFile(filename, (int)start, count, out bytesReadSize))
188              {              {
189                  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);
190              }              }

Legend:
Removed from v.246  
changed lines
  Added in v.249

  ViewVC Help
Powered by ViewVC 1.1.22