2011-11-24 132 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)