detours2.1 VC6中编译方法及源代码及使用例子及编译好的BIN
2012-07-12 10:56
316 查看
detours2.1 VC6中编译方法及源代码及使用例子及编译好的BIN
下载地址http://download.csdn.net/detail/chinafe/4424305
http://download.csdn.net/detail/chinafe/4424305
1.在纯VC6环境中新建 win32 static library 项目名设为detours
2.把detours2.1 scr目录中的源文件全部添加到项目
3.在Project->Seting->C/C++->Preprocessor definitions中添加DETOURS_X86
4.打开项目中detoured.cpp把里面DllMain函数名修改为LengFeng(否则使用时会出现DllMain冲突)error LNK2005: _DllMain@12 already defined in ***.obj
5.直接编译就可以生成detours.lib
6.在需要的项目中使用detours.lib和detours.h 就可以了
7.附件中提供了编译好的detours.lib和系统源代码
注意:需要在没有安装SDK的环境编译,如果安装过SDK,请把SDK的顺序调到最后
detour_2.1 为源码
detours_bin 为BIN
hook_send 为例子
2012-7-12 冷风 QQ 121121606
例子代码
下载地址
http://download.csdn.net/detail/chinafe/4424305
下载地址http://download.csdn.net/detail/chinafe/4424305
http://download.csdn.net/detail/chinafe/4424305
1.在纯VC6环境中新建 win32 static library 项目名设为detours
2.把detours2.1 scr目录中的源文件全部添加到项目
3.在Project->Seting->C/C++->Preprocessor definitions中添加DETOURS_X86
4.打开项目中detoured.cpp把里面DllMain函数名修改为LengFeng(否则使用时会出现DllMain冲突)error LNK2005: _DllMain@12 already defined in ***.obj
5.直接编译就可以生成detours.lib
6.在需要的项目中使用detours.lib和detours.h 就可以了
7.附件中提供了编译好的detours.lib和系统源代码
注意:需要在没有安装SDK的环境编译,如果安装过SDK,请把SDK的顺序调到最后
detour_2.1 为源码
detours_bin 为BIN
hook_send 为例子
2012-7-12 冷风 QQ 121121606
例子代码
下载地址
http://download.csdn.net/detail/chinafe/4424305
#include <windows.h> #include <tchar.h> #include <stdio.h> #include "detours.h" #pragma comment(lib,"detours.lib") static LONG dwSlept = 0; // Target pointer for the uninstrumented Sleep API. // static VOID (WINAPI * TrueSleep)(DWORD dwMilliseconds) = Sleep; // Detour function that replaces the Sleep API. // VOID WINAPI TimedSleep(DWORD dwMilliseconds) { // Save the before and after times around calling the Sleep API. DWORD dwBeg = GetTickCount(); TrueSleep(dwMilliseconds); DWORD dwEnd = GetTickCount(); InterlockedExchangeAdd(&dwSlept, dwEnd - dwBeg); } // DllMain function attaches and detaches the TimedSleep detour to the // Sleep target function. The Sleep target function is referred to // through the TrueSleep target pointer. // BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved) { if (dwReason == DLL_PROCESS_ATTACH) { DetourRestoreAfterWith(); DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); DetourAttach(&(PVOID&)TrueSleep, TimedSleep); DetourTransactionCommit(); } else if (dwReason == DLL_PROCESS_DETACH) { DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); DetourDetach(&(PVOID&)TrueSleep, TimedSleep); DetourTransactionCommit(); } return TRUE; }
相关文章推荐
- Detours2.1静态库编译和使用方法
- <转>Detours2.1静态库编译和使用方法
- Detours2.1静态库编译和使用方法
- Detours2.1静态库编译和使用方法
- 如何编译PHP源代码(Zend Encode使用方法)
- Detours 3.0 Express VC6.0编译方法及简单使用
- 使用vc 编译 wpcap.dll(WpcapSrc_4_0_2.zip版本)时 struct sockaddr_storage编译通不过的解决方法.
- 一个小例子集合xlrd,matplotlib,numpy,scipy使用方法(从Excel导入数据)
- VC6使用GDI+的配置方法
- Boost正则表达式的编译与使用方法集
- 交叉编译boa后在开发板运行boa出现-/bin/sh: boa: not found 错误的解决方法
- "不安全代码只会在使用 /unsafe 编译的情况下出现"的解决方法
- Spring boot(20) Spring /Spring boot使用AOP、强制使用cglib(以记录方法耗时为例子)
- 不使用VS将源代码编译成DLL
- 使用vs2015编译VTK INSTALL-仅用于项目-仅生成INSTALL出错解决方法
- Ubuntu16.04 QtCreater无法使用搜狗输入法输入中文的解决方法(不需要编译安装)
- win7+vs2012编译、使用libcurl获取网页源代码
- ioctl 的使用方法详细说明与例子
- (转)rawQuery()方法的使用例子
- 转载)VC6编译驱动的方法(含32和64位)