1.X版本的Detours源码中是没有Detoured.dll这个库的,
在所以在2.1版本中加入这个库,我查看了源码,发现是在DetourGetDetouredMarker()是进行调用的,而文档上说是为了作标记。我觉得这里作法不是太好,所幸我们也很少用它。
Detours是可以多次挂钩的,因此我们可以放心去除Detoured.dll的调用。(若使用,必须将Detoured.dll放到系统目录下)
编辑 src/detours.cpp这个文件
注释掉以下3处:
1,
//#include "detoured.h"
2,
//#ifdef DETOURS_INTERNAL_USAGE
//#error Feature not supported in this release.
//
//#else
// Detoured();
//#endif
3,
//#ifdef DETOURS_INTERNAL_USAGE
//#error Feature not supported in this release.
//
//
//#else
// return Detoured();
//#endif
把3这里改成:return ::GetModuleHandle(NULL);
这样重新编译后,在编dll时就不用引用detoured.lib
分发dll时也不用detoured.dll了