32-bit - 构建 32 位 Detours 库

标签 32-bit nmake detours

我正在使用微软的 Detours 库,并且我使用的是 32 位版本(免费)。我现在安装的是 64 位 Windows 7,但似乎无法使用 nmake 编译 Detours。

这是错误:

Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

        cd "C:\Program Files (x86)\Microsoft Research\Detours Express 2.1\src"
Building for 64-bit X64.
        if not exist "..\include" mkdir "..\include"
        if not exist "..\lib" mkdir "..\lib"
        if not exist "..\bin" mkdir "..\bin"
        cl /LD /nologo /W4 /WX /Zi /MTd /Gy /Gm- /Zl /O1 /DWIN32_LEAN_AND_MEAN /
D_WIN32_WINNT=0x403 /D_WIN64 /DDETOURS_X64=1 /D_AMD64_ /Wp64 /Fe..\bin\detoured.
dll /Fd..\bin\detoured.pdb detoured.cpp  /link /release /machine:amd64 /base:0xf
000000 /incremental:no /subsystem:console  /entry:DllMain /implib:..\lib\detoure
d.lib  /export:Detoured kernel32.lib detoured.res
cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be
removed in a future release
detoured.cpp
c:\program files (x86)\microsoft visual studio 9.0\vc\include\codeanalysis\sourc
eannotations.h(17) : error C2371: 'size_t' : redefinition; different basic types

        detoured.cpp : see declaration of 'size_t'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\basetsd.h(305) : warning C
4311: 'type cast' : pointer truncation from 'const void *' to 'unsigned long'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\basetsd.h(314) : warning C
4311: 'type cast' : pointer truncation from 'const void *' to 'long'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\basetsd.h(323) : warning C
4312: 'type cast' : conversion from 'unsigned long' to 'void *' of greater size
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnt.h(12935) : error C38
61: '__readfsdword': identifier not found
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\
VC\BIN\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\
VC\BIN\nmake.exe"' : return code '0x2'
Stop.

如您所见,它正在尝试编译 64 位。如何强制 nmake 构建 32 位?

谢谢, 戴夫

最佳答案

下次,只需设置 DETOURS_TARGET_PROCESSOR 环境变量即可。有效值为 x86、AMD64 和 IA64。 (Detours 的 Express 版本仅支持 x86。)

关于32-bit - 构建 32 位 Detours 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3719480/

相关文章:

c - 如何计算 32 位无符号整数中的前导零

.net - 64 位 .NET 的优点/缺点是什么?

c++ - QWT 安装错误

c++ - 防止 DLL 文件通过 MS Detours 加载到我的进程中

c++ - 如何使用 DetourAttach() 作为指向十六进制函数的指针?

c - 为什么 DetourFindFunction() 找不到函数的地址?

delphi - 如何使我的 32 位 Delphi 应用程序能够在 64 位 Windows 上使用 4GB 内存(通过 Wow64.exe)?

python - 从 python 32 位到 python 64 位

windows - 构建 OpenSSL x64 静态库时出现错误 "error A2009: syntax error in expression"

boost - CMake FindBoost 为 -mt-s 库后缀