These are chat archives for EasyHook/EasyHook

7th
Aug 2016
Chris Lapa
@GusBricker
Aug 07 2016 07:58
Hello
Is it possible with Easyhook to have multiple hook 'clients' in the one dll that gets injected into an application?
Currently I'm getting an exception: System.Runtime.Remoting.RemotingException: Attempted to call a method declared on type 'TestApp.Hooks.WindowHookInterface' on an object which exposes 'TestApp.Hooks.TextHookInterface'
I've got two files: WindowHook.cs and TextHook.cs in my DLL, which are hooking some Windows/Text API's in Windows.
The TextHookInterface works when I remove the WindowHookInterface from the project. When I add it back I get an exception.
The exception occurs when I try start the RemoteHook server for the TextHookInterface
Can anyone give me some pointers?
Justin Stenning
@spazzarama
Aug 07 2016 10:27
@GusBricker sounds like your IPC needs a bit of work, either you need to open multiple channels (i.e. pass in two channel names) for the two interfaces, or create a single interface that exposes the two.
Chris Lapa
@GusBricker
Aug 07 2016 10:43
@spazzarama I'm fairly new to IPC, do you mean my app should expose multiple IPC servers to the DLL?
Justin Stenning
@spazzarama
Aug 07 2016 11:52
@GusBricker If you have a two interfaces for it yes, otherwise look at combining them.
Chris Lapa
@GusBricker
Aug 07 2016 12:00
I have combined them
@spazzarama Is it possible to debug across this IPC link?
The other thing I dont understand is. In my HookInterface, how exactly is the state of this interface shared? Do both the DLL and the app have access to all the data within that object? Ie, if the HookInterface defines a member variable which is an int, will both the DLL and the app see the same value in that int if one side changes it?
Chris Lapa
@GusBricker
Aug 07 2016 12:42
I want to essentially invoke a function in the DLL's AppDomain from the Applications AppDomain, is that possible?
Justin Stenning
@spazzarama
Aug 07 2016 21:24
@GusBricker you can debug across it but need to attach debugger to both apps.
the Direct3DHook project uses event handlers to trigger code in the hooked app, alternatively you can create another IPC channel in the hooked app and notify via the existing IPC what the channel name is back to your main app.
the direct3dhook project configured a bidirectional connection, you can see how this works in the IEasyhook.entrypoint constructor.