Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Runtime.InteropServices;
- using System.Diagnostics;
- namespace ConsoleApplication1
- {
- class Program
- {
- [DllImport("kernel32.dll")]
- public static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesRead);
- public static byte[] ReadBytes(IntPtr Handle, Int64 Address, uint BytesToRead)
- {
- IntPtr ptrBytesRead;
- byte[] buffer = new byte[BytesToRead];
- ReadProcessMemory(Handle, new IntPtr(Address), buffer, BytesToRead, out ptrBytesRead);
- return buffer;
- }
- public static int ReadInt32(Int64 Address, IntPtr Handle)
- {
- return BitConverter.ToInt32(ReadBytes(Handle, Address, 4), 0);
- }
- public static string ReadString(long Address, IntPtr Handle, uint length = 32)
- {
- return ASCIIEncoding.Default.GetString(ReadBytes(Handle, Address, length)).Split('\0')[0];
- }
- static void Main(string[] args)
- {
- Process Tibia = Process.GetProcessesByName("Tibia")[0];
- IntPtr Handle = Tibia.Handle;
- UInt32 Base = (UInt32)Tibia.MainModule.BaseAddress.ToInt32();
- UInt32 MaxHpAdr = 0x9A702C;
- UInt32 Xor = 0x812588;
- Console.WriteLine("HP : "+Convert.ToString(ReadInt32(Base + MaxHpAdr,Handle)));
- Console.WriteLine("XOR: "+Convert.ToString(ReadInt32(Base+MaxHpAdr,Handle) ^ ReadInt32(Base+Xor,Handle)));
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement