知道一个程序的句柄,怎么才能得到它的内存地址?
程序A 是我要做的程序。
程序B(游戏)是我要监视的程序。
现在我知道了 程序B的进程ID、句柄。
问题是我怎么才能知道这个程序B的起始地址??
给一小段能运行的代码就行。要能运行的。要能运行的。

解决方案 »

  1.   

    每个程序都有自己私有的4GB内存空间,在2k下可以直接读写另一个进程的的数据,你可以查找一下我在这里写过的一篇小文。说说你具体的目的
      

  2.   

    用下面函数试试
    BOOL GetProcessMemoryInfo(
      HANDLE Process,  // handle to the process
      PPROCESS_MEMORY_COUNTERS ppsmemCounters,
                       // structure that receives information
      DWORD cb         // size of the structure
    );
      

  3.   

    程序句柄是什么意思?如果是指窗体句柄的话~~~先用GetWindowThreadProcessId获取进程ID再用OpenProcess打开进程,用VirtualQueryEx和ReadProcessMemory即可获得虚存中的数据这种问题很明显应该去MSDN中找答案
      

  4.   

    每个程序都有自己私有的4GB内存空间,这个我是知道的,我只是想知道一下这个4GB的内存空间的起始地址。ehom(?!) 的方法只是找到了想找的数据,但是我只是想知道那个那个程序的起始内存地址。不知道这个想法有没有问题。因为我要找的数据的位置的相对偏移量总是不变的。所以只要用起始地址+偏移量就行了。
      

  5.   

    这说是虚存,不是物理内存的地址,所有进程的起始地址自然都是0x00000000另外用API GetSystemInfo可获得可以使用的最小地址lpMinimumApplicationAddress
      

  6.   

    GetWindowThreadProcessId 取得是线程id 而不是进程id :<
      

  7.   

    BOOL GetProcessMemoryInfo(
      HANDLE Process,  // handle to the process
      PPROCESS_MEMORY_COUNTERS ppsmemCounters,
                       // structure that receives information
      DWORD cb         // size of the structure
    );
      

  8.   

    难道说获得进程ID用GetWindowProcessID?可惜没有啊~~~The GetWindowThreadProcessId function retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window. 取自MSDN
      

  9.   

    MFC库中的CWindow类倒是有个成员CWindow::GetWindowThreadID,可惜这说的是API啊