/[RomCheater]/trunk/Win32/Sojaner.MemoryScanner/MemoryScanner.cs
ViewVC logotype

Diff of /trunk/Win32/Sojaner.MemoryScanner/MemoryScanner.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 168 by william, Mon May 28 08:31:56 2012 UTC revision 169 by william, Mon May 28 08:49:42 2012 UTC
# Line 69  namespace Sojaner.MemoryScanner Line 69  namespace Sojaner.MemoryScanner
69          }          }
70    
71    
72          public bool DumpMemory(string filename, uint MemoryAddress, uint bytesToRead, out int bytesRead)          public bool DumpMemory(Process ppid, string filename, uint MemoryAddress, uint bytesToRead, out int bytesRead)
73          {          {
74                logger.Info.WriteLine("Dumping memory (0x{0:x8}-0x{1:x8}) from pid=({3}) to file {2}", MemoryAddress, MemoryAddress + bytesToRead, filename, string.Format("0x{0:x4} {1}.exe", ppid.Id, ppid.ProcessName));
75              bytesRead = 0;              bytesRead = 0;
76              uint byte_alignment = 102400; // write to file in 100mb chunks              uint byte_alignment = 102400; // write to file in 100mb chunks
77              uint address = MemoryAddress;              uint address = MemoryAddress;
# Line 119  namespace Sojaner.MemoryScanner Line 120  namespace Sojaner.MemoryScanner
120                      }                      }
121                      bw.Close();                      bw.Close();
122                  }                  }
123                    logger.Info.WriteLine("Succefully dumped memory (0x{0:x8}-0x{1:x8}) from pid=({3}) to file {2}", MemoryAddress, MemoryAddress + bytesToRead, filename, string.Format("0x{0:x4} {1}.exe", ppid.Id, ppid.ProcessName));
124                  return true;                  return true;
125              }              }
126              catch (OutOfMemoryException ex)              catch (OutOfMemoryException ex)
127              {              {
128                    logger.Error.WriteLine("Failed to dump memory (0x{0:x8}-0x{1:x8}) from pid=({3}) to file {2}", MemoryAddress, MemoryAddress + bytesToRead, filename, string.Format("0x{0:x4} {1}.exe", ppid.Id, ppid.ProcessName));
129                  logger.Error.WriteLine("DumpMemory(): OutOfMemoryException");                  logger.Error.WriteLine("DumpMemory(): OutOfMemoryException");
130                  logger.Error.WriteLine(ex.ToString());                  logger.Error.WriteLine(ex.ToString());
131              }              }
132              catch (Exception ex)              catch (Exception ex)
133              {              {
134                    logger.Error.WriteLine("Failed to dump memory (0x{0:x8}-0x{1:x8}) from pid=({3}) to file {2}", MemoryAddress, MemoryAddress + bytesToRead, filename, string.Format("0x{0:x4} {1}.exe", ppid.Id, ppid.ProcessName));
135                  logger.Error.WriteLine("DumpMemory(): Exception");                  logger.Error.WriteLine("DumpMemory(): Exception");
136                  logger.Error.WriteLine(ex.ToString());                  logger.Error.WriteLine(ex.ToString());
137              }              }

Legend:
Removed from v.168  
changed lines
  Added in v.169

  ViewVC Help
Powered by ViewVC 1.1.22