These are chat archives for EasyHook/EasyHook

11th
Nov 2016
Jeff Swenson
@jrswenson
Nov 11 2016 00:14
Can EasyHook be used inside of a Windows Service? I have code that works as expected when ran InterActively, but doesn't work when ran as a Service. When ran as a service I don't get any exceptions.
Justin Stenning
@spazzarama
Nov 11 2016 04:09
@jrswenson you need to implement some form of IPC, you could simply use a wait event handle. Are you saying injection is failing when the injector is a service? There are operating system security features that prevent certain cross-session operations, I can't remember trying it for some time now.
Jeff Swenson
@jrswenson
Nov 11 2016 04:20
@spazzarama Thanks for the response. I have IPC working. In both scenarios the injection works and the local hooks are created with out exception. So I'm stumped! Something security related would make sense. I'm hoping I'm just missing a setting or something.
Justin Stenning
@spazzarama
Nov 11 2016 05:37
Oh so it is injecting successfully and hooking from service? Is your hook being hit? Debugger?
Jeff Swenson
@jrswenson
Nov 11 2016 05:53

Yep. I'm able to attach the Visual Studio debugger to the service process and the process to the target app. I can step through both and see the injection works. I can also see the call to create the local hook works. When I run the exe directly, everything works as expected. When I run it as a service it doesn't.(I also have logging were I can see the expected logs and no exceptions) I'm testing by hooking SetWindowText and overwriting the text.

Thanks again for the response!

Justin Stenning
@spazzarama
Nov 11 2016 07:03
Does your localhook get called when you are debugging the target and using the service? If injection has worked then whether or not u are using a service will no longer matter. Do you have some IPC logic or other stuff that could be failing? If you haven't already keep your injection code super basic, create a basic hook (just hard code some stuff) as a sanity check. Like I said, if you can debug the target process and step through the injected library then something else is going on.
Jeff Swenson
@jrswenson
Nov 11 2016 07:08
First thing in the morning I'll do a super simple project, even more simple than what I've done, if I can reproduce the problem, I'll put the project on my Git. Otherwise, maybe it will help me find the root cause.