Memory Reading Tutorials
XtrmJosh on Structures:
http://youtu.be/uySmUTotGJk
XtrmJosh response on finding the CID after having found the battle list:
http://youtu.be/oIxMAY7Mn-I
Puterin on a whole array of things:
http://youtu.be/NcZXDcrCZFA
Code:
- Gui Start & Text in Chat: 00:19:53
- Last Status Bar & TibiaTime: 00:36:17
- X Y Z Locations & Goto: 01:03:16
XtrmJosh on Reading Pointers:
http://youtu.be/mo2-DE05Z10
Sample code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace TestApp
{
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(long Address, uint length = 4, IntPtr? Handle = null)
{
return BitConverter.ToInt32(ReadBytes((IntPtr)Handle, Address, length), 0);
}
public static string ReadString(long Address, uint length = 32, IntPtr? Handle = null)
{
string temp3 = ASCIIEncoding.Default.GetString(ReadBytes((IntPtr)Handle, Address, length));
string[] temp3str = temp3.Split('\0');
return temp3str[0];
}
static void Main(string[] args)
{
UInt32 Address = 0x3BE800;
// get process
Process Tibia = Process.GetProcessesByName("Tibia")[0];
// dump base
Console.WriteLine("Base Address : " + Tibia.MainModule.BaseAddress.ToString());
UInt32 Base = (UInt32)Tibia.MainModule.BaseAddress.ToInt32();
// read pointer
UInt32 Ptr1 = (UInt32)ReadInt32(Address + Base, 4, Tibia.Handle);
Console.WriteLine("Pointer 1 : " + Ptr1.ToString());
UInt32 Ptr2 = (UInt32)ReadInt32(Ptr1 + 0x40, 4, Tibia.Handle);
Console.WriteLine("Pointer 2 : " + Ptr2.ToString());
UInt32 Ptr3 = (UInt32)ReadInt32(Ptr2 + 0x44, 4, Tibia.Handle);
Console.WriteLine("Pointer 3 : " + Ptr3.ToString());
UInt32 Ptr4 = (UInt32)ReadInt32(Ptr3 + 0x2C, 4, Tibia.Handle);
Console.WriteLine("Pointer 4 : " + Ptr4.ToString());
// read memory pointer points to
string PtrRead = ReadString(Ptr4, 255, Tibia.Handle);
Console.WriteLine("String read from Pointer : " + PtrRead);
Console.ReadLine();
}
}
}