文件名称:apihooktest2
- 所属分类:
- 钩子与API截获
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 143kb
- 下载次数:
- 0次
- 提 供 者:
- d**
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
一、前言
前一段时间发表了一篇文章 “Hook API 工具”,没有附带主程序的源代码,这几天翻出来代码加了些注释,现在补上。不过大家还是最好看看牛的书,书上讲解很详细。
二、对代码的简单说明
总共3个工程,1个主程序,1个HookDll, 1个例子Dll。主程序负责启动进程,并将 HookDll 注入。还有一些额外的功能,比如显示 Log, 例子Dll的信息,导出函数等,HookDll 在 DllMain 启动的时候根据配置钩住指定的 API 函数
三、这种方法的缺点
这种方法是在系统 API 函数起始代码 和 自定义代码之间切换。在多线程的环境下,如果正在切换的过程,其它线程调用这个函数,会出现异常,同时,如果已经切换回系统代码,其它线程对这个API 的调用将抓不到。解决方法就是不要切换,这点应该是可以做到的。
四、结束语
在例子Dll 中,模仿了 ws_32.dll 的输出函数,但是不全,而且 Log 信息也不足,感兴趣的朋友如果有比较全的版本别忘了发给我一份 :)
程序大家可以随意修改,保留那个林月如的 Icon 就行了 ^_^
-one, the preamble some time ago published an article entitled "Hook API tool," not incidental to the main program source code, which turned out a few days code plus some notes now fill. But we still look at the best cattle in the book, spoke on the very detailed. Two of the code simple instructions a total of three projects, a program, a HookDll, an example Dll. Main program to start the process and will HookDll injection. There are some additional features, such as Log shows examples Dll information derived function, in DllMain HookDll boot time configuration hooked designated API Function 3, the shortcomings of this method This method is the system API function code and starting from the definition of switching between code. In multithreaded environment, if the switching proces
前一段时间发表了一篇文章 “Hook API 工具”,没有附带主程序的源代码,这几天翻出来代码加了些注释,现在补上。不过大家还是最好看看牛的书,书上讲解很详细。
二、对代码的简单说明
总共3个工程,1个主程序,1个HookDll, 1个例子Dll。主程序负责启动进程,并将 HookDll 注入。还有一些额外的功能,比如显示 Log, 例子Dll的信息,导出函数等,HookDll 在 DllMain 启动的时候根据配置钩住指定的 API 函数
三、这种方法的缺点
这种方法是在系统 API 函数起始代码 和 自定义代码之间切换。在多线程的环境下,如果正在切换的过程,其它线程调用这个函数,会出现异常,同时,如果已经切换回系统代码,其它线程对这个API 的调用将抓不到。解决方法就是不要切换,这点应该是可以做到的。
四、结束语
在例子Dll 中,模仿了 ws_32.dll 的输出函数,但是不全,而且 Log 信息也不足,感兴趣的朋友如果有比较全的版本别忘了发给我一份 :)
程序大家可以随意修改,保留那个林月如的 Icon 就行了 ^_^
-one, the preamble some time ago published an article entitled "Hook API tool," not incidental to the main program source code, which turned out a few days code plus some notes now fill. But we still look at the best cattle in the book, spoke on the very detailed. Two of the code simple instructions a total of three projects, a program, a HookDll, an example Dll. Main program to start the process and will HookDll injection. There are some additional features, such as Log shows examples Dll information derived function, in DllMain HookDll boot time configuration hooked designated API Function 3, the shortcomings of this method This method is the system API function code and starting from the definition of switching between code. In multithreaded environment, if the switching proces
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ApiHookTest
...........\ApiHookTest.clw
...........\ApiHookTest.cpp
...........\ApiHookTest.dsp
...........\ApiHookTest.dsw
...........\ApiHookTest.h
...........\ApiHookTest.rc
...........\ApiHookTestDlg.cpp
...........\ApiHookTestDlg.h
...........\ApiHookTool
...........\...........\Bin
...........\...........\...\ApiHook.exe
...........\...........\...\config.dat
...........\...........\...\config.ini
...........\...........\...\Hook.dll
...........\...........\...\SockHookFun.dll
...........\...........\...\tmp.txt
...........\DataEngine.cpp
...........\DataEngine.h
...........\DllInfoDlg.cpp
...........\DllInfoDlg.h
...........\HookProcess.cpp
...........\HookProcess.h
...........\HSock
...........\.....\config.dat
...........\.....\DataEngine.cpp
...........\.....\DataEngine.h
...........\.....\HookApiInterFace.h
...........\.....\HookProcess.cpp
...........\.....\HookProcess.h
...........\.....\Hooks.cpp
...........\.....\Hooks.h
...........\.....\HSock.cpp
...........\.....\HSock.dsp
...........\.....\HSock.dsw
...........\.....\HSock.h
...........\.....\HSock.plg
...........\.....\ReadMe.txt
...........\.....\StdAfx.cpp
...........\.....\StdAfx.h
...........\MyStatic.cpp
...........\MyStatic.h
...........\res
...........\...\ApiHookTest.rc2
...........\Resource.h
...........\SockHookFun
...........\...........\Hook.lib
...........\...........\HookApiInterFace.h
...........\...........\HSock.lib
...........\...........\res
...........\...........\resource.h
...........\...........\SockHookFun.cpp
...........\...........\SockHookFun.def
...........\...........\SockHookFun.dsp
...........\...........\SockHookFun.dsw
...........\...........\SockHookFun.h
...........\...........\SockHookFun.rc
...........\...........\StdAfx.cpp
...........\...........\StdAfx.h
...........\StdAfx.cpp
...........\StdAfx.h
...........\ApiHookTest.clw
...........\ApiHookTest.cpp
...........\ApiHookTest.dsp
...........\ApiHookTest.dsw
...........\ApiHookTest.h
...........\ApiHookTest.rc
...........\ApiHookTestDlg.cpp
...........\ApiHookTestDlg.h
...........\ApiHookTool
...........\...........\Bin
...........\...........\...\ApiHook.exe
...........\...........\...\config.dat
...........\...........\...\config.ini
...........\...........\...\Hook.dll
...........\...........\...\SockHookFun.dll
...........\...........\...\tmp.txt
...........\DataEngine.cpp
...........\DataEngine.h
...........\DllInfoDlg.cpp
...........\DllInfoDlg.h
...........\HookProcess.cpp
...........\HookProcess.h
...........\HSock
...........\.....\config.dat
...........\.....\DataEngine.cpp
...........\.....\DataEngine.h
...........\.....\HookApiInterFace.h
...........\.....\HookProcess.cpp
...........\.....\HookProcess.h
...........\.....\Hooks.cpp
...........\.....\Hooks.h
...........\.....\HSock.cpp
...........\.....\HSock.dsp
...........\.....\HSock.dsw
...........\.....\HSock.h
...........\.....\HSock.plg
...........\.....\ReadMe.txt
...........\.....\StdAfx.cpp
...........\.....\StdAfx.h
...........\MyStatic.cpp
...........\MyStatic.h
...........\res
...........\...\ApiHookTest.rc2
...........\Resource.h
...........\SockHookFun
...........\...........\Hook.lib
...........\...........\HookApiInterFace.h
...........\...........\HSock.lib
...........\...........\res
...........\...........\resource.h
...........\...........\SockHookFun.cpp
...........\...........\SockHookFun.def
...........\...........\SockHookFun.dsp
...........\...........\SockHookFun.dsw
...........\...........\SockHookFun.h
...........\...........\SockHookFun.rc
...........\...........\StdAfx.cpp
...........\...........\StdAfx.h
...........\StdAfx.cpp
...........\StdAfx.h