构建 32 位 Detours 库

发布于 2024-09-24 05:10:03 字数 2116 浏览 8 评论 0原文

我正在使用微软的 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 位?

谢谢, 戴夫

I'm using Detours library from microsoft, and I was using the 32bit version (which is free). I'm now on a 64-bit installation of windows 7 and I can't seem to compile Detours with nmake.

Here is the error:

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.

As you see, it's trying to compile for 64-bit. How can I force nmake to build for 32bits?

Thanks,
Dave

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

晨光如昨 2024-10-01 05:10:04

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

Next time, simply set the DETOURS_TARGET_PROCESSOR environment variable. Valid values are x86, AMD64 and IA64. (The Express version of Detours only supports x86.)

你是年少的欢喜 2024-10-01 05:10:04

我需要 Windows SDK 来编译。只需googlewindfows SDK,下载并安装即可。安装,在管理模式下运行Windows SDK控制台并编译!

如果在 Windows 7 上安装 SDK 出现错误,解决方案如下:

http://support.microsoft.com /kb/2717426/de

当您在安装了较新版本的 Visual C++ 2010 Redistributable 的计算机上安装 Windows 7 SDK 时,会出现此问题。 Windows 7 SDK 安装 Visual C++ 2010 Redistributable 版本 10.0.30319。

要解决此问题,您必须先卸载所有版本的 Visual C++ 2010 Redistributable,然后再安装 Windows 7 SDK。您可能安装了以下一个或多个产品:

  • Microsoft Visual C++ 2010 x86 Redistributable
  • Microsoft Visual C++ 2010 x64 Redistributable

I needed windows SDK to compile. Simply google windfows SDK, download & install, run the Windows SDK console in admin mode and compile!

If installing SDK on windows 7 gives errors, here is the solution:

http://support.microsoft.com/kb/2717426/de

This issue occurs when you install the Windows 7 SDK on a computer that has a newer version of the Visual C++ 2010 Redistributable installed. The Windows 7 SDK installs version 10.0.30319 of the Visual C++ 2010 Redistributable.

To resolve this issue, you must uninstall all versions of the Visual C++ 2010 Redistributable before installing the Windows 7 SDK. You may have one or more of the following products installed:

  • Microsoft Visual C++ 2010 x86 Redistributable
  • Microsoft Visual C++ 2010 x64 Redistributable
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文