Last active
June 9, 2017 03:16
-
-
Save XiiSky/29de254ec2a3a9e715ef93147de95357 to your computer and use it in GitHub Desktop.
Get Base Address Game.dll Warcraft III
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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