我意识到我获取正确 baseaddress
的版本是错误的
Process[] iexp = Process.GetProcessesByName("Solitaire");
if (iexp.Length == 0) {
//EXIT
}
Process internet = iexp[0];
uint baseAddress = (uint)internet.MainModule.BaseAddress.ToInt64();
但是baseaddress
是错误的
我还查看了 MSDN但是 this代码很奇怪,给我一个无限循环。
我希望你能帮助我,因为我找不到任何例子。
编辑:
ReadProcessMemory(readHandle, ((IntPtr)(((baseAddress) + 0x14) + 0x50)), bytes, (UIntPtr)4, ref rw);
在这里,我制作了我的桌面图像。 我真的很困惑,也许有人知道我在哪里犯了错误。 http://i.stack.imgur.com/50lva.jpg
最佳答案
如果你想要我认为你想要的,我只能想到几种方法,虽然它们都不是.NET 内置的......
使用 P/Invoke 返回启动可执行文件的基地址。
[DllImport("kernel32.dll")] public static extern IntPtr GetModuleHandle(string lpModuleName);
返回包含 MyClass 的可执行文件的基地址
Marshal.GetHINSTANCE(typeof(MyClass).Module)
返回当前模块的句柄:
Marshal.GetHINSTANCE(this.GetType().Module)
关于c# - 找到正确的基地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8263135/