Microsoft Detours:缺少宏

Microsoft Detours: missing macro

我需要有关使用 Microsoft Detours 的项目的帮助。

前提:我正在尝试使用 class 我在 project on CodeProject 中发现的使用弯路图书馆。我从Github下载了最新版的Detuors并重新编译,但是找不到宏的定义DETOUR_TRAMPOLINE。我想在新版本的Detours中它已经以某种方式被替换了。

在使用这个缺失宏的项目中,是这样使用的:

DETOUR_TRAMPOLINE(BOOL WINAPI Detour_EnableScrollBar(HWND hwnd, int wSBflags, UINT wArrows), EnableScrollBar);
DETOUR_TRAMPOLINE(BOOL WINAPI Detour_GetScrollInfo  (HWND hwnd, int fnBar, LPSCROLLINFO lpsi), GetScrollInfo);
DETOUR_TRAMPOLINE(int  WINAPI Detour_GetScrollPos   (HWND hwnd, int nBar), GetScrollPos);
DETOUR_TRAMPOLINE(BOOL WINAPI Detour_GetScrollRange (HWND hwnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos), GetScrollRange);
DETOUR_TRAMPOLINE(int  WINAPI Detour_SetScrollInfo  (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw), SetScrollInfo);
DETOUR_TRAMPOLINE(int  WINAPI Detour_SetScrollPos   (HWND hwnd, int nBar, int nPos, BOOL fRedraw), SetScrollPos);
DETOUR_TRAMPOLINE(int  WINAPI Detour_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, BOOL fRedraw), SetScrollRange);
DETOUR_TRAMPOLINE(BOOL WINAPI Detour_ShowScrollBar  (HWND hwnd, int wBar, BOOL fShow), ShowScrollBar);

问题:

在此先感谢您的帮助!

谷歌搜索 "#define DETOUR_TRAMPOLINE" 显示:

#define DETOUR_TRAMPOLINE(trampoline,target) \
static PVOID __fastcall _Detours_GetVA_##target(VOID) \
{ \
    return ⌖ \
} \

正如 JHBonarius 在他的评论中所解释的那样,自从删除了相关宏后,已经发布了许多版本的 Detours,因此快速更改相关代码可能并不容易。

我想向那些感兴趣的人指出一个非常简单且包含的库,它与 Detours 一样,允许您重定向 Windows API(即使它提供的功能少得多)。

有问题的库是MinHook,源代码仍然可用here