69 |
|
} |
70 |
|
|
71 |
|
|
72 |
< |
public bool DumpMemory(string filename, uint MemoryAddress, uint bytesToRead, out int bytesRead) |
72 |
> |
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; |
76 |
|
uint byte_alignment = 102400; // write to file in 100mb chunks |
77 |
|
uint address = MemoryAddress; |
120 |
|
} |
121 |
|
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; |
125 |
|
} |
126 |
|
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"); |
130 |
|
logger.Error.WriteLine(ex.ToString()); |
131 |
|
} |
132 |
|
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"); |
136 |
|
logger.Error.WriteLine(ex.ToString()); |
137 |
|
} |