How do you get HINSTANCE the code module?
Like MS Visual C+ get
HINSTANCE(exe or dll) where the current function is present?
I agree that option with
__ImageBaseIn some cases, two other standard methods could be used.
Most often needed
HINSTANCEMajor Programme (EXE). It's easier to use. https://msdn.microsoft.com/ru-RU/library/windows/desktop/ms683199(v=vs.85).aspx ♪
Another typical situation that we wrote DLL callingback function and someone calling her. In this case, we usually have the paramenals transferred to our vain module. With help
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESSI'll get it.
HMODULEAdes of variable, a
HINSTANCEDLL is what it is.
There are many other ways. But decisive is in what context we are.
I personally, in my time, gave a lot to do with the general memorial of the program I put on. https://stackoverflow.com/a/3010909/315935 ♪ It shows that the vast virtual space of the process is blocked and each block belongs to its module. With the start of the module, all information about it can be found. I believe that
GetModuleHandleExIt works like that.