具体的代码

解决方案 »

  1.   

    可是怎么得到 其中的 HMODULE hModule 参数呢? 现在我只知道通过GetModuleHandle (LPCTSTR lpModuleName)获得,还是得先知道dll的名称才行啊!
      

  2.   

    我的程序是ATL的不是MFC的,不能用AfxGetInstanceHandle(),怎么办呢?
      

  3.   

    This function gets a module file name.WINAPI DWORD GetModuleFileName( 
      HMODULE hModule,
      LPWSTR lpFilename, 
      DWORD nSize
    );ParametershModule
        [in] Handle to the module whose executable file name is being requested. If this parameter is NULL, GetModuleFileName returns the path for the file used to create the calling process. 
    lpFilename
        [out] Pointer to a buffer that is filled in with the path and file name of the given module. 
    nSize
        [in] Specifies the length, in characters, of the lpFilename buffer. If the length of the path and file name exceeds this limit, the string is truncated. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcekernl/html/_wcesdk_GetModuleFileName.asp
      

  4.   

    仅供参考:
    先VirtualQuery()出当前代码段的base address,第一个参数就是eip的值
    把base address当作HMODULE来用,再调GetModuleFileName()