module handle through base address
Im' trying to get the module h开发者_开发问答andle of a module in C++ on windows.
My problem is that I have only the base address and File handle of the module but GetModuleHandle receives only its name as a parameter. Is there a way in c++ on windows to obtain a module handle without knwoing the module's name?Have you tried using GetModuleHandleEx
(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCTSTR)lpBaseAddress, &module)
?
Use GetModuleHandleEx if you use WindowsXP or later. For previous Windows versions like Windows2000 this function is not available, but there is alternate solution, check comments at the bottom of this page: http://msdn.microsoft.com/en-us/library/ms683200(v=VS.85).aspx
精彩评论