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 234 by william, Sun Jun 3 12:36:47 2012 UTC vs.
Revision 235 by william, Sun Jun 3 12:44:26 2012 UTC

# Line 214 | Line 214 | namespace Sojaner.MemoryScanner
214          }
215  
216          #region IMemoryReader Members
217 <        public bool ReadFirstNonZeroByte(uint MemoryAddress, int bytesToRead, out uint address)
217 >        public bool ReadFirstNonZeroByte(uint MemoryAddress, uint bytesToRead, out uint address)
218          {
219              //logger.Info.WriteLine("Dumping memory (0x{0:x8}-0x{1:x8}) from pid=({2})", MemoryAddress, MemoryAddress + bytesToRead, string.Format("0x{0:x4} {1}.exe", ppid.Id, ppid.ProcessName));
220              address = 0;
221 <            int byte_alignment = 1;
221 >            uint byte_alignment = 1;
222              // get common init parameters
223              //InitMemoryDump(out byte_alignment);
224              uint mem_address = MemoryAddress;
225 <            int _bytesToRead = bytesToRead;
225 >            uint _bytesToRead = bytesToRead;
226              byte[] buffer = new byte[] { };
227              try
228              {
# Line 230 | Line 230 | namespace Sojaner.MemoryScanner
230                  //{
231                  //    //BinaryWriter bw = new BinaryWriter(ms);
232                  //    //foreach (byte b in data) { bw.Write(b); }
233 <                for (int i = 0; i <= bytesToRead; )
233 >                for (uint i = 0; i <= bytesToRead; )
234                  {
235                      if (_bytesToRead < byte_alignment)
236                      {
# Line 286 | Line 286 | namespace Sojaner.MemoryScanner
286              }
287              return false;
288          }
289 <        public void ReadProcessMemory(uint MemoryAddress, int bytesToRead, out int bytesRead, out byte[] data)
289 >        public void ReadProcessMemory(uint MemoryAddress, uint bytesToRead, out int bytesRead, out byte[] data)
290          {
291              byte[] buffer = new byte[] { };
292              IntPtr ptrBytesRead;
293 <            uint _bytesToRead = (uint)bytesToRead;
294 <            ProcessMemoryReader.ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (UIntPtr)MemoryAddress, buffer, _bytesToRead, out ptrBytesRead);
293 >            ProcessMemoryReader.ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (UIntPtr)MemoryAddress, buffer, bytesToRead, out ptrBytesRead);
294              bytesRead = ptrBytesRead.ToInt32();
295              data = buffer;
296          }
# Line 312 | Line 311 | namespace Sojaner.MemoryScanner
311  
312          #region IFileWriter Members
313  
314 <        public bool WriteProcessMemoryToFile(string filename, uint MemoryAddress, int bytesToRead, out int bytesRead)
314 >        public bool WriteProcessMemoryToFile(string filename, uint MemoryAddress, uint bytesToRead, out int bytesRead)
315          {
316              //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));
317              bytesRead = 0;
318 <            int byte_alignment = 102400;
318 >            uint byte_alignment = 102400;
319              uint address = MemoryAddress;
320 <            int _bytesToRead = bytesToRead;
320 >            uint _bytesToRead = bytesToRead;
321              byte[] buffer = new byte[] { };
322              try
323              {
# Line 330 | Line 329 | namespace Sojaner.MemoryScanner
329                      BinaryWriter bw = new BinaryWriter(fs);
330                      //foreach (byte b in data) { bw.Write(b); }
331  
332 <                    for (int i = 0; i <= bytesToRead; )
332 >                    for (uint i = 0; i <= bytesToRead; )
333                      {
334                          if (_bytesToRead < byte_alignment)
335                          {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines