Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4769
  • Last Modified:

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
0
adnan562
Asked:
adnan562
  • 4
  • 2
1 Solution
 
Daniel Van Der WerkenCommented:
0
 
adnan562Author Commented:
Thanx Dan7el

But using GetModuleHandle() u need to know the name of module, which i mentioned i dont have.
0
 
MechanTOurSCommented:
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_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, functionPtr, &handle );
GetModuleFileNameA(handle , path, __countof(path));

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
adnan562Author Commented:

GetModuleHandleEx is for XP.
Any solution for windows 2000
0
 
MechanTOurSCommented:
0
 
adnan562Author Commented:
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
0
 
adnan562Author Commented:
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
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now