0

I'm developing a dll and I need to know some information of the process where it will be attached to, to take desitions whether I hook calls to some functions or not. For instance, if process is explorer.exe I don't want to do anything of that, just when the process is firefox.exe. To set up global hooks I use the "AppInit_DLLs infrastructure" so the Operating System is who calls LoadLibrary, not the process explicitely. The hook process take place in DllMain, so there is where I need the information.

Thank in advance.

Omar Mainegra
  • 4,006
  • 22
  • 30

1 Answers1

0

To get the file of the process which is loading your DLL you can use GetModuleFileName:

char szExeFileName[MAX_PATH];
GetModuleFileName(NULL, szExeFileName, MAX_PATH);
GuidedHacking
  • 3,628
  • 1
  • 9
  • 59