Windows Process Hooking

Hello community,

i dont get it how to hook the running process of my .exe into f. ex. notepad.exe process. I dont find anything usable in the internet, but only dll or shellcode injections. What i want is to hook myself into another process and moving on with execution in that same executable.

How is that possible?
Can i get a code example?

kind regards,

Last edited on
"Hooking" means that you replace a certain function with your own implementation, so that whenever the hooked function gets called anywhere in the program your function gets invoked instead of the original.

There exists libraries for that:

...usually you do this inside of your own process though!

Executing some code in the context of another process is possible via "DLL injection":

In a nutshell, you use CreateRemoteThread() to start a new thread within the context of the other process. And then you let that new thread invoke LoadLibraryA(), in order to load (or "inject") your DLL into the other process. This finally gives you the chance to execute your own code, i.e. the code in your DLL, within the context of the other process – because the DLL's DllMain() function will be executed when it gets loaded.

This code then may install a hook, or do whatever you like...
Last edited on
Registered users can post here. Sign in or register to post.