Finding the correct baseaddress

泄露秘密 提交于 2019-12-04 04:10:15

If you want what I think you want, I can only think of a few ways to do it, none of them are .NET built-in though...

  1. Use P/Invoke to return the base address of the startup executable.

    [DllImport("kernel32.dll")]
    public static extern IntPtr GetModuleHandle(string lpModuleName);
    
  2. Returns the base address of the executable containing MyClass

    Marshal.GetHINSTANCE(typeof(MyClass).Module)
    
  3. Return a handle to the current module using:

    Marshal.GetHINSTANCE(this.GetType().Module)
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!