how to turn on a localhook again after dispose() it?

Nov 10, 2008 at 5:13 AM
hi,Chrithph

I inject a hook in to another process. and that process called the localhook.dispose() to invalid the hook. After this, how can turn up the hook again in that process?

If the remoteinject(..) calls Dllmain in a DLL with a message of DLL_PROCESS_ATTACH,
so the second call of remoteinject(..) will not enter the DLL_PROCESS_ATTACH procedure and the hook will not be set.
Is that right?

is there any convenient way to control a hook in other process? To turn it on and off..on and off...on and off.....
:)

thank you very much.

Nov 12, 2008 at 10:32 PM
simpliy reinstall the hook...

no but you can use NET remoting to set the hook state remotely...

regards
chris
Nov 26, 2008 at 2:58 AM
the Sumsung ID is also mine. :)

if I create a IPCserverchannel in Client, Ipc is closed after one connection from Server side. I don't know why.But the Client can always connect to Server and change Server's object steadily.

If I want to change the ACL of this localhook objects, I have to call member function of the "class Injection:easyhook.IEntryPoint", so the Injection class has to be remoting object inherited from Marshalbyrefobject.If I do this, I got error saying"some struct or class is not serializable", I mean Localhook or something else which has defination in Easyhook lib and other lib can not be changed into serializable.

How can I call a member function in other object? obviously,if I can get the ref of the object, I can call it's memeber function.and the object should be singleton in the application domain.but the class Injection can not be changed into Singleton designed pattern, there is so litte I can change, I don't know if it will affect the whole injection and hooking architecture.


the same question: is there any convenient way to control a hook in other process? To turn it on and off..on and off...on and off.....

thank you ,chris, please help me..
Nov 26, 2008 at 1:46 PM
>if I create a IPCserverchannel in Client, Ipc is closed after one connection from Server side.

I am not really sure what you mean...

>If I want to change the ACL of this localhook objects, I have to call member function of the "class Injection:easyhook.IEntryPoint", so the Injection class has to be remoting object inherited from Marshalbyrefobject.If I do this, I got error saying"some struct or class is not serializable"

Just declare a procedure in the example remoting object used in FileMon, and pass proper parameters to realize this task... Since this proc is executed in the target you have native access to all your hook objects within this remote routine...

>How can I call a member function in other object? 

I am again not sure what you mean. During IPC server creation you can set the mode to singleton/singlecall by passing the proper WellKnownObjectMode to IPCCreateServer().

>I don't know if it will affect the whole injection and hooking architecture.

definitely not, because it is a public option you can choose during server creation...

>the same question: is there any convenient way to control a hook in other process? To turn it on and off..on and off...on and off.....

no... But it is pretty easy with NET remoting...

My advice is that you learn more about the NET remoting first, because it seems as if all your question are only related to remoting issues and not to EasyHook itself...

regards
chris