moze mi neko "compile" ovo:
class Program
{
private const uint gNetClient = 0x8A5C34;
static void Main(string[] args)
{
try
{
Memory mem = new Memory("WoW");
uint netClient = gNetClient + mem.Base;
uint basePtr = mem.Read<uint>(netClient);
uint ofs1 = basePtr + 0x464C; // bool QueuePacketsForConnection1;
uint ofs2 = basePtr + 0x464D; // bool QueuePacketsForConnection2;
uint ofs3 = basePtr + 0x461C; // ServerConnection* pConnection1;
uint ofs4 = basePtr + 0x4620; // ServerConnection* pConnection2;
byte val1 = mem.Read<byte>(ofs1);
uint ptr1 = mem.Read<uint>(ofs3);
mem.Write(ofs2, val1); // QueuePacketsForConnection2 = QueuePacketsForConnection1;
mem.Write(ofs4, ptr1); // pConnection2 = pConnection1;
Console.WriteLine("WoW patched! You may now enter the world!");
Console.WriteLine("When disconnected from the server press enter and run the program again when back in character list!");
Console.WriteLine("When you wanna close WoW press enter to make changes undone!");
Console.ReadKey();
mem.Write(ofs2, (byte)1);
mem.Write(ofs4, (uint)0);
Console.WriteLine("WoW patched back! You can now login again or close wow without error! Press any key to close program!");
Console.ReadKey();
return;
}
catch (ArgumentException)
{
Console.WriteLine("Could not open WoW! Please start WoW first, enter the character list and run the program!");
Console.ReadKey();
return;
}
}
}
i evo Memory class
public class Memory
{
IntPtr m_hProcess;
uint m_modBase;
public Memory(string processName)
{
Process[] matches = Process.GetProcessesByName(processName);
if (matches == null || matches.Length == 0)
throw new ArgumentException("No process exists with that name!", "processName");
m_hProcess = matches[0].Handle;
m_modBase = (uint)matches[0].MainModule.BaseAddress.ToInt32();
}
public uint Base { get { return m_modBase; } }
public T Read<T>(IntPtr address) where T : struct
{
return Read<T>((uint)address.ToInt32());
}
public unsafe T Read<T>(uint address) where T : struct
{
int size = Marshal.SizeOf(typeof(T));
byte[] buffer = new byte[size];
int ret = ReadProcessMemory(m_hProcess, address, buffer, size);
if (ret == 0)
throw new ArgumentException("address is not valid!", "address");
fixed(byte* ptr = buffer)
{
IntPtr pMem = new IntPtr(ptr);
return (T)Marshal.PtrToStructure(pMem, typeof(T));
}
}
public void Write<T>(IntPtr addr, T value) where T : struct
{
Write((uint)addr.ToInt32(), value);
}
public void Write<T>(uint addr, T value) where T : struct
{
int size = Marshal.SizeOf(value);
IntPtr ptr = Marshal.AllocCoTaskMem(size);
Marshal.StructureToPtr(value, ptr, false);
int ret = WriteProcessMemory(m_hProcess, addr, ptr, size);
Marshal.FreeCoTaskMem(ptr);
if (ret == 0)
throw new ArgumentException("address is not valid!", "address");
}
[DllImport("Kernel32.dll")]
private static extern int ReadProcessMemory(IntPtr proc, uint addr, [In, Out]byte[] buffer, int len, uint ret = 0);
[DllImport("Kernel32.dll")]
private static extern int WriteProcessMemory(IntPtr proc, uint addr, IntPtr buffer, int len, uint ret = 0);
}
- +/- sve poruke
- ravni prikaz
- starije poruke gore
poanta posta je?
sta ti tocno treba?
Ima veze sa world-of-warcraft emulator-servers,