Process in and out..

c++ / delphi package - dll injection and api hooking

Process in and out..

Postby Claes » Thu Jun 24, 2004 4:15 pm

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

Postby madshi » Fri Jun 25, 2004 9:17 am

The easiest way is to poll (= set up a timer and check every second). Of course that's not really nice... :?
madshi
Site Admin
 
Posts: 9649
Joined: Sun Mar 21, 2004 5:25 pm

Postby Claes » Fri Jun 25, 2004 12:42 pm

True! So can you tell me the easiest, but nicest way?
Claes
 
Posts: 52
Joined: Thu Apr 22, 2004 10:52 pm
Location: Denmark

Postby madshi » Fri Jun 25, 2004 1:27 pm

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

Postby Claes » Mon Jun 28, 2004 12:46 pm

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

Btw.: What is WMI?
Claes
 
Posts: 52
Joined: Thu Apr 22, 2004 10:52 pm
Location: Denmark

Postby madshi » Mon Jun 28, 2004 5:41 pm

Windows Management Instrumentation
madshi
Site Admin
 
Posts: 9649
Joined: Sun Mar 21, 2004 5:25 pm


Return to madCodeHook

Who is online

Users browsing this forum: No registered users and 3 guests