Process in and out..

c++ / delphi package - dll injection and api hooking
Post Reply
Claes
Posts: 52
Joined: Thu Apr 22, 2004 10:52 pm
Location: Denmark

Process in and out..

Post 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?
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

The easiest way is to poll (= set up a timer and check every second). Of course that's not really nice... :?
Claes
Posts: 52
Joined: Thu Apr 22, 2004 10:52 pm
Location: Denmark

Post by Claes »

True! So can you tell me the easiest, but nicest way?
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post 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.
Claes
Posts: 52
Joined: Thu Apr 22, 2004 10:52 pm
Location: Denmark

Post by Claes »

Ok, then my app. must live and die with the target app. :(

Btw.: What is WMI?
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Windows Management Instrumentation
Post Reply