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

Comparing trunk/Win32/Sojaner.MemoryScanner/MemoryScanner.cs (file contents):
Revision 167 by william, Mon May 28 08:31:56 2012 UTC vs.
Revision 169 by william, Mon May 28 08:49:42 2012 UTC

--- trunk/Win32/Sojaner.MemoryScanner/MemoryScanner.cs	2012/05/28 08:31:56	167
+++ trunk/Win32/Sojaner.MemoryScanner/MemoryScanner.cs	2012/05/28 08:49:42	169
@@ -69,8 +69,9 @@ namespace Sojaner.MemoryScanner
         }
 
 
-        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)
         {
+            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));
             bytesRead = 0;
             uint byte_alignment = 102400; // write to file in 100mb chunks
             uint address = MemoryAddress;
@@ -119,15 +120,18 @@ namespace Sojaner.MemoryScanner
                     }
                     bw.Close();
                 }
+                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));
                 return true;
             }
             catch (OutOfMemoryException ex)
             {
+                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));
                 logger.Error.WriteLine("DumpMemory(): OutOfMemoryException");
                 logger.Error.WriteLine(ex.ToString());
             }
             catch (Exception ex)
             {
+                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));
                 logger.Error.WriteLine("DumpMemory(): Exception");
                 logger.Error.WriteLine(ex.ToString());
             }