2011-11-24 147 views
7

我意识到,我得到了正确的baseaddress的版本是错误的找到正确的baseaddress

Process[] iexp = Process.GetProcessesByName("Solitaire"); 
if (iexp.Length == 0) { 
    //EXIT 
} 
Process internet = iexp[0]; 
uint baseAddress = (uint)internet.MainModule.BaseAddress.ToInt64(); 

baseaddress是错误的

我也看了在MSDNthis代码是很奇怪的,给了我一个无限循环。

我希望你能帮助我,因为我找不到任何例子。

编辑:

ReadProcessMemory(readHandle, ((IntPtr)(((baseAddress) + 0x14) + 0x50)), bytes, (UIntPtr)4, ref rw); 

在这里,我做了我的桌面的图像。 我真的很困惑,也许有人知道我犯了一个错误。 http://i.stack.imgur.com/50lva.jpg

+4

[DllImport("kernel32.dll")] public static extern IntPtr GetModuleHandle(string lpModuleName); 
  • 返回包含MyClass的

    Marshal.GetHINSTANCE(typeof(MyClass).Module) 
  • 返回使用手柄当前的模块可执行文件的基址错误的基地址?你链接的代码对我来说似乎是合理的... –

  • 回答

    2

    如果你想要什么,我想你想,我只能想到的几个方法可以做到这一点,他们都不是.NET内置虽然...

    1. 使用P/Invoke返回启动可执行文件的基地址。你怎么知道这是返回

      Marshal.GetHINSTANCE(this.GetType().Module)