博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
detours2.1 VC6中编译方法及源代码及使用例子及编译好的BIN
阅读量:2401 次
发布时间:2019-05-10

本文共 1904 字,大约阅读时间需要 6 分钟。

detours2.1 VC6中编译方法及源代码及使用例子及编译好的BIN

下载地址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 
#include
#include
#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;}

转载地址:http://wwvob.baihongyu.com/

你可能感兴趣的文章
你好, View Binding! 再次再见, findViewById!
查看>>
Android 锁屏无法继续定位问题
查看>>
2020 年需要关注的 5 大 Android 开发技术
查看>>
ViewStub你肯定听过,但是这些细节了解吗?
查看>>
职场修炼场:2019年裸辞的人,现在都在做什么
查看>>
我把废旧 Android 手机改造成了 Linux 服务器
查看>>
Jetpack 系列组件:ViewModel 从相遇到相知
查看>>
漫画:聊聊线程池中,线程的增长/回收策略
查看>>
不使用synchronized和lock,如何实现一个线程安全的单例?
查看>>
原来Glide是这样加载GIF图的
查看>>
Android低功耗蓝牙总结
查看>>
终于有人把大厂必问的Android技术点整理为PDF,简直是天才,已跪
查看>>
做个酷炫的“锤子” 开关效果,隔壁产品都馋哭了
查看>>
ViewPager懒加载极致优化
查看>>
Kotlin 源码里成吨的 noinline 和 crossinline 是干嘛的?
查看>>
20年入秋Android面经分享(已获头条、顺丰、OPPO等大厂offer)
查看>>
98%Android开发者已收藏的“80”个开源库
查看>>
面试官: 说一下你做过哪些性能优化?
查看>>
三年啦,跳槽成功的Android开发面经总结!
查看>>
两年外包公司经验,拿到字节跳动Android offer,我的付出不止一点点
查看>>