--- trunk/Win32/Sojaner.MemoryScanner/MemoryScanner.cs 2012/06/03 12:38:31 234 +++ trunk/Win32/Sojaner.MemoryScanner/MemoryScanner.cs 2012/06/03 12:44:26 235 @@ -214,15 +214,15 @@ namespace Sojaner.MemoryScanner } #region IMemoryReader Members - public bool ReadFirstNonZeroByte(uint MemoryAddress, int bytesToRead, out uint address) + public bool ReadFirstNonZeroByte(uint MemoryAddress, uint bytesToRead, out uint address) { //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)); address = 0; - int byte_alignment = 1; + uint byte_alignment = 1; // get common init parameters //InitMemoryDump(out byte_alignment); uint mem_address = MemoryAddress; - int _bytesToRead = bytesToRead; + uint _bytesToRead = bytesToRead; byte[] buffer = new byte[] { }; try { @@ -230,7 +230,7 @@ namespace Sojaner.MemoryScanner //{ // //BinaryWriter bw = new BinaryWriter(ms); // //foreach (byte b in data) { bw.Write(b); } - for (int i = 0; i <= bytesToRead; ) + for (uint i = 0; i <= bytesToRead; ) { if (_bytesToRead < byte_alignment) { @@ -286,12 +286,11 @@ namespace Sojaner.MemoryScanner } return false; } - public void ReadProcessMemory(uint MemoryAddress, int bytesToRead, out int bytesRead, out byte[] data) + public void ReadProcessMemory(uint MemoryAddress, uint bytesToRead, out int bytesRead, out byte[] data) { byte[] buffer = new byte[] { }; IntPtr ptrBytesRead; - uint _bytesToRead = (uint)bytesToRead; - ProcessMemoryReader.ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (UIntPtr)MemoryAddress, buffer, _bytesToRead, out ptrBytesRead); + ProcessMemoryReader.ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (UIntPtr)MemoryAddress, buffer, bytesToRead, out ptrBytesRead); bytesRead = ptrBytesRead.ToInt32(); data = buffer; } @@ -312,13 +311,13 @@ namespace Sojaner.MemoryScanner #region IFileWriter Members - public bool WriteProcessMemoryToFile(string filename, uint MemoryAddress, int bytesToRead, out int bytesRead) + public bool WriteProcessMemoryToFile(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; - int byte_alignment = 102400; + uint byte_alignment = 102400; uint address = MemoryAddress; - int _bytesToRead = bytesToRead; + uint _bytesToRead = bytesToRead; byte[] buffer = new byte[] { }; try { @@ -330,7 +329,7 @@ namespace Sojaner.MemoryScanner BinaryWriter bw = new BinaryWriter(fs); //foreach (byte b in data) { bw.Write(b); } - for (int i = 0; i <= bytesToRead; ) + for (uint i = 0; i <= bytesToRead; ) { if (_bytesToRead < byte_alignment) { |