Hooking already running process #256
-
Hi, Is it possible to hook a process that already is running using Detours? I used one of creatwth procedures (DetourCreateProcessWithDllExW) as the base for my tests and created a procedure that opens a process (OpenProcess) instead of its creation (CreateProcess), almost all the other logic is the same. My code:
As you can see, it consumes PID and desired access flags that equal PROCESS_ALL_ACCESS for the tests. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
DetourUpdateProcessWithDll updates the import table of a process so it doesn't work if the process is already running. It only works when the process has been started suspended so hasn't loaded DLLs yet. To inject in an already running process, you have to use VirtualAllocEx + WriteProcessMemory + CreateRemoteThread + LoadLibrary. |
Beta Was this translation helpful? Give feedback.
DetourUpdateProcessWithDll updates the import table of a process so it doesn't work if the process is already running. It only works when the process has been started suspended so hasn't loaded DLLs yet. To inject in an already running process, you have to use VirtualAllocEx + WriteProcessMemory + CreateRemoteThread + LoadLibrary.