How can I know a process is already injected a dll?

Aug 15, 2012 at 11:08 AM
Edited Aug 15, 2012 at 11:12 AM

If I call RemoteHooking.Inject() several times on the same target process, the target process (or injecting process) sometimes crashes.

Is there any way to determine the process is already hooked or not?

 

Aug 15, 2012 at 4:38 PM
Edited Aug 15, 2012 at 4:38 PM

Okay.. I solved the problem like this:

public void Run(RemoteHooking.IContext context, string ipcChannelName, bool reportException, bool reportMessage) {
    bool createdNew;
    Mutex mutex = new Mutex(false, String.Format("MyHook.Mutex.PID{0}", RemoteHooking.GetCurrentProcessId()), out createdNew);
    if (!createdNew) return;

    ........
}