Detours 的 x64 到 x86 转换问题

问题描述

我想在我的项目中使用 repo detours.net 来挂钩本机 win32 api 函数。它正在为 x64 应用程序创建,但不适用于 x86 应用程序。因此,我已将 detours 目录中的 CMakeList.txt 更改为 -E env DetoURS_TARGET_PROCESSOR=X86,并使用以下命令创建 Visual Studio 项目文件cmake -G "Visual Studio 16 2019" -A Win32 ..\detours.net。尝试构建解决方案后,我在此行中收到错误消息:

return DetourEnumerateImportsEx(hModule,&context,nullptr,UnsandBox);
Severity    Code    Description Project File    Line    Suppression State
Error   C2664   'BOOL DetourEnumerateImportsEx(HMODULE,PVOID,PF_DetoUR_IMPORT_FILE_CALLBACK,PF_DetoUR_IMPORT_FUNC_CALLBACK_EX)': cannot convert argument 4 from 'BOOL (__cdecl *)(PVOID,DWORD,LPCSTR,PVOID *)' to 'PF_DetoUR_IMPORT_FUNC_CALLBACK_EX'   DetoursDll  C:\Users\sebastian\source\repos\de32\detours.net\detours.net\DetoursDll\src\DetoursDll.cpp  30

但是 PF_DetoUR_IMPORT_FILE_CALLBACK 对函数 'UnsandBox' 的定义似乎是正确的:

typedef BOOL (CALLBACK *PF_DetoUR_IMPORT_FUNC_CALLBACK_EX)(_In_opt_ PVOID pContext,_In_ DWORD nordinal,_In_opt_ LPCSTR pszFunc,_In_opt_ PVOID* ppvFunc);
static BOOL UnsandBox(_In_opt_ PVOID pContext,_In_opt_ PVOID* ppvFunc)

它的构建对于 x64 没有任何问题,但对于 x86 则没有。我错过了什么吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)