其他分享
首页 > 其他分享> > c – 为64位编译Microsoft Detours

c – 为64位编译Microsoft Detours

作者:互联网

detours软件包声称支持64位,但我没有看到编译64位二进制文​​件的方法:

Detouring 32-bit and 64-bit Processes

使用nmake只编译32位的东西:

>dir
 Volume in drive D is Volume
 Volume Serial Number is XXXX-XXXX

 Directory of D:\Detours

06/21/2018  03:46 PM    <DIR>          .
06/21/2018  03:46 PM    <DIR>          ..
06/23/2018  08:13 PM    <DIR>          bin.X86
06/20/2017  09:03 AM             5,105 CREDITS.TXT
06/22/2017  03:06 PM                31 Detours Version 3.0 Build_343
10/19/2016  12:06 PM           113,685 Detours.chm
06/23/2018  08:12 PM    <DIR>          include
06/23/2018  08:12 PM    <DIR>          lib.X86
10/29/2015  02:19 PM             7,144 LICENSE.RTF
12/21/2016  01:22 PM             1,851 Makefile
06/22/2017  03:06 PM            14,961 README.TXT
06/21/2018  03:04 PM    <DIR>          samples
06/23/2018  08:12 PM    <DIR>          src
10/29/2015  02:19 PM             4,841 system.mak
06/22/2017  03:06 PM                31 VERSION.TXT

nmake size64命令无效.

如果我在我的Visual Studio C项目中使用库(lib.X86文件夹)配置为生成64位DLL,我得到相应的错误,它将不会生成:

library machine type 'x86' conflicts with target machine type 'x64'

将文件夹lib.X86重命名为lib.X64也不起作用.

如何让它在64位环境中工作或者不可能?

解决方法:

It seems like you have to set the target processor to 64-bit and then compile.工作批处理(.bat)脚本可能类似于以下内容(取决于您的Visual Studio安装):

SET DETOURS_TARGET_PROCESSOR=X64
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
NMAKE

有了这个,64位二进制文​​件应该成功编译.

标签:detours,c,windows,visual-studio
来源: https://codeday.me/bug/20190910/1801266.html