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 162 by william, Mon May 28 07:12:37 2012 UTC vs.
Revision 164 by william, Mon May 28 07:49:48 2012 UTC

# Line 72 | Line 72 | namespace Sojaner.MemoryScanner
72          public bool DumpMemory(string filename, uint MemoryAddress, uint bytesToRead, out int bytesRead)
73          {
74              bytesRead = 0;
75 <            uint byte_alignment = 512; // 4mb alignment
75 >            uint byte_alignment = 16; // 16 byte alignment
76              uint address = MemoryAddress;
77              try
78              {
# Line 86 | Line 86 | namespace Sojaner.MemoryScanner
86                          byte[] buffer = new byte[byte_alignment];
87                          uint bytes_to_read = byte_alignment;
88                          IntPtr ptrBytesRead;
89 <                        ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (IntPtr)address, buffer, bytes_to_read, out ptrBytesRead);
89 >                        ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (UIntPtr)address, buffer, bytes_to_read, out ptrBytesRead);
90                          bytesRead = ptrBytesRead.ToInt32();
91                          bw.Write(buffer);
92                          bw.Flush();
# Line 124 | Line 124 | namespace Sojaner.MemoryScanner
124                      byte[] buffer = new byte[byte_alignment];
125                      uint bytes_to_read = byte_alignment;
126                      IntPtr ptrBytesRead;
127 <                    ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (IntPtr)address, buffer, bytes_to_read, out ptrBytesRead);
127 >                    ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (UIntPtr)address, buffer, bytes_to_read, out ptrBytesRead);
128                      bytesRead = ptrBytesRead.ToInt32();
129                      aligned_array_list.Add(buffer);                    
130                      address += byte_alignment;
# Line 148 | Line 148 | namespace Sojaner.MemoryScanner
148              return new byte[] { };
149          }
150  
151 <        public void WriteProcessMemory(IntPtr MemoryAddress, byte[] bytesToWrite, out int bytesWritten)
151 >        public void WriteProcessMemory(UIntPtr MemoryAddress, byte[] bytesToWrite, out int bytesWritten)
152          {
153              IntPtr ptrBytesWritten;
154              ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, MemoryAddress, bytesToWrite, (uint)bytesToWrite.Length, out ptrBytesWritten);
# Line 203 | Line 203 | namespace Sojaner.MemoryScanner
203              //                  SIZE_T * lpNumberOfBytesRead  // number of bytes read
204              //                  );
205              [DllImport("kernel32.dll")]
206 <            public static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesRead);
206 >            public static extern Int32 ReadProcessMemory(IntPtr hProcess, UIntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesRead);
207  
208              //          BOOL WriteProcessMemory(
209              //                  HANDLE hProcess,                // handle to process
# Line 213 | Line 213 | namespace Sojaner.MemoryScanner
213              //                  SIZE_T * lpNumberOfBytesWritten // count of bytes written
214              //                  );
215              [DllImport("kernel32.dll")]
216 <            public static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);
216 >            public static extern Int32 WriteProcessMemory(IntPtr hProcess, UIntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);
217  
218  
219          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines