How to hook a function on a process that is running