Skip to content

Instantly share code, notes, and snippets.

@XiiSky
Last active June 9, 2017 03:16
Show Gist options
  • Save XiiSky/29de254ec2a3a9e715ef93147de95357 to your computer and use it in GitHub Desktop.
Save XiiSky/29de254ec2a3a9e715ef93147de95357 to your computer and use it in GitHub Desktop.
Get Base Address Game.dll Warcraft III
using System;
using System.Diagnostics;
namespace MemoryTest {
class Program {
public static void Main(string[] args) {
Console.Title = "Memory Test";
Console.WriteLine(GetGameDLLBaseAddr("Game.dll", "war3"));
Console.ReadLine();
}
static string GetGameDLLBaseAddr(string moduleName, string procName) {
var baseAddr = 0;
var p = Process.GetProcessesByName(procName);
if (p.Length != 0) {
for (int i = 0, maxModulesCount = p[0].Modules.Count; i < maxModulesCount; i++) {
var modules = p[0].Modules[i];
if (moduleName.ToLower() == modules.ModuleName.ToLower()) {
baseAddr = (int) modules.BaseAddress;
return string.Format("0x{0:x8}", baseAddr);
}
}
}
baseAddr = -1;
return string.Format("0x{0:x8}", baseAddr);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment