/[RomCheater]/trunk/Win32/Sojaner.MemoryScanner/MemoryScanner.cs
ViewVC logotype

Diff of /trunk/Win32/Sojaner.MemoryScanner/MemoryScanner.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/Win32/Sojaner.MemoryScanner/MemoryScanner.cs	2013/06/06 07:56:04	577
+++ trunk/Win32/Sojaner.MemoryScanner/MemoryScanner.cs	2013/06/06 08:18:44	578
@@ -225,7 +225,7 @@
 
         #region IMemoryReader Members
         #region public bool ReadFirstNonZeroByte(uint MemoryAddress, uint bytesToRead, out int address)
-        public bool ReadFirstNonZeroByte(ulong MemoryAddress, uint bytesToRead, out ulong address)
+        public bool ReadFirstNonZeroByte(ulong MemoryAddress, ulong bytesToRead, out ulong 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;
@@ -233,7 +233,7 @@
             // get common init parameters
             //InitMemoryDump(out byte_alignment);
             ulong mem_address = MemoryAddress;
-            uint _bytesToRead = bytesToRead;
+            ulong _bytesToRead = bytesToRead;
             byte[] buffer = new byte[] { };
             try
             {
@@ -241,7 +241,7 @@
                 //{
                 //    //BinaryWriter bw = new BinaryWriter(ms);
                 //    //foreach (byte b in data) { bw.Write(b); }
-                for (uint i = 0; i <= bytesToRead; )
+                for (ulong i = 0; i <= bytesToRead; )
                 {
                     if (_bytesToRead < byte_alignment)
                     {
@@ -253,7 +253,7 @@
                         _bytesToRead = byte_alignment;
                         buffer = new byte[byte_alignment];
                     }
-                    int bytesRead = 0;
+                    ulong bytesRead = 0;
                     ReadProcessMemory(mem_address, _bytesToRead, out bytesRead, out buffer);
                     if (buffer.Length == 0 && bytesRead == 0)
                     {
@@ -309,16 +309,16 @@
         #endregion
 
 
-        public void UpdateAddressArray(ulong[] addresses, uint size, out byte[][] values)
+        public void UpdateAddressArray(ulong[] addresses, ulong size, out byte[][] values)
         {
             // size = size of data to read at each address
             values = new byte[addresses.Length][];
             for (int x = 0; x < values.Length; x++) { values[x] = new byte[size]; }
-            
-            for (int i = 0; i < addresses.Length; i++)
+
+            for (ulong i = 0; i < (ulong)addresses.Length; i++)
             {
                 byte[] data = new byte[size];
-                int bytesRead =0;
+                ulong bytesRead = 0;
                 var address = addresses[i];
                 this.ReadProcessMemory(address, size, out bytesRead, out data);
                 values[i] = data;
@@ -326,7 +326,7 @@
         }
 
 
-        public void ReadProcessMemoryAtOnce(ulong MemoryAddress, uint bytesToRead, object UserState)
+        public void ReadProcessMemoryAtOnce(ulong MemoryAddress, ulong bytesToRead, object UserState)
         {
             uint size = 128;
             //int count = 0;
@@ -351,7 +351,7 @@
                 }
             }
         }
-        public void ReadProcessMemoryAtOnce(ulong MemoryAddress, uint bytesToRead, out int bytesRead, out byte[] data)
+        public void ReadProcessMemoryAtOnce(ulong MemoryAddress, ulong bytesToRead, out ulong bytesRead, out byte[] data)
         {
             Stopwatch st = new Stopwatch();
             st.Start();
@@ -373,7 +373,7 @@
                 bigMem = null;
             }
 
-            bytesRead = buffer_list.Count;
+            bytesRead = (ulong)buffer_list.Count;
             data = new byte[bytesToRead];
             data.Initialize();
             Buffer.BlockCopy(buffer_list.ToArray(), 0, data, 0, (int)bytesToRead);
@@ -381,11 +381,11 @@
             logger.Profiler.WriteLine("ReadProcessMemoryAtOnce(): start=0x{0:x8} end=0x{1:x8} took {2:0.0000} seconds", MemoryAddress, MemoryAddress + bytesToRead, st.Elapsed.TotalSeconds);
         }
         #region public void ReadProcessMemory(int MemoryAddress, uint bytesToRead, out int bytesRead, out byte[] data)
-        public void ReadProcessMemory(long MemoryAddress, uint bytesToRead, out int bytesRead, out byte[] data)
+        public void ReadProcessMemory(long MemoryAddress, long bytesToRead, out ulong bytesRead, out byte[] data)
         {
-            ReadProcessMemory((ulong)MemoryAddress, bytesToRead, out bytesRead, out data);
+            ReadProcessMemory((ulong)MemoryAddress, (ulong)bytesToRead, out bytesRead, out data);
         }
-        public void ReadProcessMemory(ulong MemoryAddress, uint bytesToRead, out int bytesRead, out byte[] data)
+        public void ReadProcessMemory(ulong MemoryAddress, ulong bytesToRead, out ulong bytesRead, out byte[] data)
         {
             try
             {
@@ -454,13 +454,13 @@
 
         #region IMemoryWriter Members
         #region public void WriteProcessMemory(uint MemoryAddress, byte[] bytesToWrite, out int bytesWritten)
-        public void WriteProcessMemory(long MemoryAddress, byte[] bytesToWrite, out int bytesWritten)
+        public void WriteProcessMemory(long MemoryAddress, byte[] bytesToWrite, out ulong bytesWritten)
         {
-            uint _bytesWritten = 0;
+            ulong _bytesWritten = 0;
             WriteProcessMemory((ulong)MemoryAddress, bytesToWrite, out _bytesWritten);
-            bytesWritten = (int)_bytesWritten;
+            bytesWritten = (ulong)_bytesWritten;
         }
-        public void WriteProcessMemory(ulong MemoryAddress, byte[] bytesToWrite, out uint bytesWritten)
+        public void WriteProcessMemory(ulong MemoryAddress, byte[] bytesToWrite, out ulong bytesWritten)
         {
             try
             {
@@ -503,13 +503,13 @@
 
         #region IFileWriter Members
         #region public bool WriteProcessMemoryToFile(string filename, uint MemoryAddress, uint bytesToRead, out int bytesRead)
-        public bool WriteProcessMemoryToFile(string filename, ulong MemoryAddress, uint bytesToRead, out int bytesRead)
+        public bool WriteProcessMemoryToFile(string filename, ulong MemoryAddress, ulong bytesToRead, out ulong 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;
             ulong address = MemoryAddress;
-            uint _bytesToRead = bytesToRead;
+            ulong _bytesToRead = bytesToRead;
             byte[] buffer = new byte[] { };
             try
             {
@@ -521,7 +521,7 @@
                     BinaryWriter bw = new BinaryWriter(fs);
                     //foreach (byte b in data) { bw.Write(b); }
 
-                    for (uint i = 0; i <= bytesToRead; )
+                    for (ulong i = 0; i <= bytesToRead; )
                     {
                         if (_bytesToRead < byte_alignment)
                         {

 

  ViewVC Help
Powered by ViewVC 1.1.22