adnan562
asked on
How To Get Current Module (dll) Handle
I need to get the name of current module (dll). I dont have the HMODULE or the name of the module.
Thanx n Advance
Thanx n Advance
ASKER
Thanx Dan7el
But using GetModuleHandle() u need to know the name of module, which i mentioned i dont have.
But using GetModuleHandle() u need to know the name of module, which i mentioned i dont have.
U can get the HMODULE with
BOOL WINAPI GetModuleHandleEx( DWORD dwFlags, LPCTSTR lpModuleName, HMODULE* phModule);
this function retrieve the module from a function pointer contained into the dll:
void *functionPtr = ...;
HMODULE handle = NULL;
char path[MAX_PATH] = "";
GetModuleHandleEx(GET_MODU LE_HANDLE_ EX_FLAG_FR OM_ADDRESS , functionPtr, &handle );
GetModuleFileNameA(handle , path, __countof(path));
BOOL WINAPI GetModuleHandleEx( DWORD dwFlags, LPCTSTR lpModuleName, HMODULE* phModule);
this function retrieve the module from a function pointer contained into the dll:
void *functionPtr = ...;
HMODULE handle = NULL;
char path[MAX_PATH] = "";
GetModuleHandleEx(GET_MODU
GetModuleFileNameA(handle , path, __countof(path));
ASKER
GetModuleHandleEx is for XP.
Any solution for windows 2000
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi MechanTOurS
Thnx alot MechanTOurS
Although it dint work for me, caz I am hooking into another process memory but it was of great help thats why I am accepting your answer.
Adnan
Thnx alot MechanTOurS
Although it dint work for me, caz I am hooking into another process memory but it was of great help thats why I am accepting your answer.
Adnan
ASKER
Hi all,
I found a solution many thanx to cmk.
See this forum at CodeProject
http://www.codeproject.com/script/comments/forums.asp?msg=1467646&forumid=1647#xx1467646xx
Adnan
I found a solution many thanx to cmk.
See this forum at CodeProject
http://www.codeproject.com/script/comments/forums.asp?msg=1467646&forumid=1647#xx1467646xx
Adnan
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getmodulehandle.asp