detours2.1 VC6中编译方法及源代码及使用例子及编译好的BIN
来源:互联网 发布:超级优化txt网盘 编辑:程序博客网 时间:2024/06/12 06:03
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
#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 VC6中编译方法及源代码及使用例子及编译好的BIN
- VC6.0命令行编译及使用makefile编译的方法
- Detours 3.0 Express VC6.0编译方法及简单使用
- gsoap编译及使用例子
- log4cxx基于VC6.0的编译及使用
- Android源代码下载及编译方法
- 制作好的交叉编译工具链下载及使用
- Chromium源代码及编译环境的配置
- android源代码下载及编译
- CyanogenMod源代码下载及编译
- android源代码下载及编译
- VC6.0编译DLL,使用VS2010调用问题及解决方法
- gdb的编译及使用
- FFMPEG的编译及使用
- libcurl的编译及使用
- DDSCAT7.1编译及使用
- vc6及vs2005的SolidWorks工程在vs2008编译
- VC6编译的Debug版本程序中存在的问题及解决方法
- Yammer的启示:如何让别人用10亿美元收购
- std::endl的作用
- Objective-C的@property 详解(ios,iphone,xcode,retain,release,assign,copy)
- C#操作XML
- [转]Android的Handler总结
- detours2.1 VC6中编译方法及源代码及使用例子及编译好的BIN
- linux matlab saveas core 掉
- spring加载xsd文件
- CentOS 6.2安装(超级详细图解教程)
- windows server 2008服务器自动重启关闭
- Ajax学习笔记
- ejb-jar.xml中详解的内容
- oracle表空间的概念
- 喇叭的灵敏度代表什么