I can inject a hook into running processes to catch when they create, destroy, max/min. But I haven’t come up with a way to catch the creation of a new process so that I can inject my hook into that one.
Does anyone know the best way to accomplish this?
I can inject a hook into running processes to catch when they create, destroy,
Share
SetWindowsHookEx is your easiest solution.
If you don’t mind upsetting the anti-virus software, you can also inject a DLL into each process that will then hook CreateProcess (to inject the DLL into further processes) and CreateWindowEx (for your purposes).
EDIT: I just read your question completely. Yes, you’ll want to just hook CreateProcessW and inject your hook into future processes.
EDIT #2: I was actually working on something like this yesterday, so some code which does what you want.