Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp4
- {
- class Program
- {
- const int PROCESS_WM_READ = 0x0010;
- [DllImport("kernel32.dll")]
- public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
- [DllImport("kernel32.dll")]
- public static extern bool ReadProcessMemory(int hProcess,
- Int64 lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
- static void Main(string[] args)
- {
- Process process = Process.GetProcessesByName("Wow")[0];
- IntPtr processHandle = OpenProcess(PROCESS_WM_READ, false, process.Id);
- int bytesRead = 0;
- byte[] btBuffer = new byte[8];
- ReadProcessMemory((int) processHandle, (long)process.MainModule.BaseAddress + 0x26243E8, btBuffer, btBuffer.Length, ref bytesRead);
- //ReadProcessMemory((int)processHandle, new IntPtr(BitConverter.ToInt64(buffer, 0) + 0x26243E8), buffer, buffer.Length, ref bytesRead);
- Console.WriteLine(Encoding.Unicode.GetString(btBuffer) +
- " (" + bytesRead.ToString() + "bytes)");
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement