Page 1 of 1

Process in and out..

Posted: Thu Jun 24, 2004 4:15 pm
by Claes
Consider this senario:

I have an app A, that injects a DLL into a certain process P. If the P is not running, I start it using CreateProcessEx. Now A and P are both running. Then P is closed by the user (I can catch this event - see "easiest way to know if a target app is closed"), and A is still running. Then P is restarted by the user. Now A should really re-inject the DLL into the new process P. But what is the easiest way to find out if P is restarted based on the exe-name?

Posted: Fri Jun 25, 2004 9:17 am
by madshi
The easiest way is to poll (= set up a timer and check every second). Of course that's not really nice... :?

Posted: Fri Jun 25, 2004 12:42 pm
by Claes
True! So can you tell me the easiest, but nicest way?

Posted: Fri Jun 25, 2004 1:27 pm
by madshi
There's just one easy way and that is polling (= ugly). There is no easy *and* nice way that I know of. Maybe WMI could notify you about new processes, but I've never tried that yet - and it doesn't work in all OSs by default.

Posted: Mon Jun 28, 2004 12:46 pm
by Claes
Ok, then my app. must live and die with the target app. :(

Btw.: What is WMI?

Posted: Mon Jun 28, 2004 5:41 pm
by madshi
Windows Management Instrumentation