I’m still trying to fully understand hooking and how easyhook works.
I’ve now written a simple example: a form that contains a webbrowser element, and i’m trying to hook recv calls made from that. When compiling, the program returns this error:
A first chance exception of type 'System.NotSupportedException' occurred in EasyHook.dll
System.NotSupportedException: STATUS_NOT_SUPPORTED: (Code: 0)
at EasyHook.NativeAPI.Force(Int32 InErrorCode)
at EasyHook.RemoteHooking.InjectEx(Int32 InHostPID, Int32 InTargetPID, Int32 InWakeUpTID, Int32 InNativeOptions, String InLibraryPath_x86, String InLibraryPath_x64, Boolean InCanBypassWOW64, Boolean InCanCreateService, Object[] InPassThruArgs)
at EasyHook.RemoteHooking.Inject(Int32 InTargetPID, InjectionOptions InOptions, String InLibraryPath_x86, String InLibraryPath_x64, Object[] InPassThruArgs)
at Hook_Test.Form1.Run() in I:\Documents and Settings\Meme\Desktop\SimpleHook\Hook Test\Hook Test\Form1.cs:line 46
at line 46, I’ve this code:
RemoteHooking.Inject(
Process.GetCurrentProcess().Id,
InjectionOptions.Default,
"TestInject.dll",
"TestInject.dll",
ChannelName);
I can’t really see where the problem is, can somebody help me out?
In the documentation for the Inject method of the RemoteHooking class it says:
It seems that this is by design. You may need to split your project into two apps, or else use shell or threading to launch instances (at least) of things outside of the current process.