我仍然在努力完全理解钩子和easyhook是如何工作的。现在,我已经编写了一个简单的示例:一个包含webbrowser元素的表单,我正在尝试挂接从该元素发出的recv调用。编译时,程序返回以下错误:
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在第46行,我有这样的代码:
RemoteHooking.Inject(
Process.GetCurrentProcess().Id,
InjectionOptions.Default,
"TestInject.dll",
"TestInject.dll",
ChannelName);我真的看不出问题出在哪里,有人能帮我吗?
发布于 2011-01-25 17:50:57
在RemoteHooking类的Inject方法的文档中,它写道:
即使在技术上可以将用于调试目的的库注入到当前进程中,它也会抛出异常。这是因为它在很大程度上依赖于您的注入库,当前进程是否会被损坏。如果挂接了错误的API,任何类型的通信都可能导致死锁。只需使用Visual Studio的功能来同时调试多个进程,这将允许您调试您的库,就像它将被注入到当前进程中一样,而不会遇到任何副作用。
看起来这是设计好的。您可能需要将您的项目拆分为两个应用程序,或者使用shell或线程来启动当前进程之外的事物的实例(至少)。
https://stackoverflow.com/questions/4606450
复制相似问题