18

我正在尝试编译 TrueCrypt。我正在使用来自https://github.com/syglug/truecrypt的说明。

我设置了 3 个环境变量 ( pkcs, ddk, MSVC16_ROOT) 并在 msvc2008 中打开了项目。这不在说明中,但我需要安装 NASM,所以我安装了它并将 NASM 放在 PATH 中。现在,当我构建时,我得到以下信息。即使 IDE 可以选择取消构建,编译器没有执行任何操作并且系统处于空闲状态,它也会结束。

在这一步之后 Crypto.lib 确实存在

1>------ Build started: Project: Crypto, Configuration: Release Win32 ------
2>------ Build started: Project: Boot, Configuration: Release Win32 ------
3>------ Build started: Project: Driver, Configuration: Release Win32 ------
2>Performing Makefile project actions
3>Performing Makefile project actions
1>Performing Custom Build Step
3>------ Building truecrypt.sys: Release x86 ------
1>Aes_hw_cpu.asm 
2>Microsoft (R) C/C++ Optimizing Compiler Version 8.00c    
2>Copyright (c) Microsoft Corp 1984-1993. All rights reserved.
3>The syntax of the command is incorrect.
3>Project : error PRJ0002 : Error result 255 returned from 'C:\Windows\SysWow64\cmd.exe'.
3>Build log was saved at "file://c:\unzipped\tc\Driver\Release\BuildLog.htm"
3>Driver - 1 error(s), 0 warning(s)
1>Performing Custom Build Step
1>Aes_x86.asm 
1>Compiling...
1>Whirlpool.c
1>Twofish.c
1>Sha2.c
1>Sha1.c
1>Serpent.c
1>Rmd160.c
1>Des.c
1>Cast.c
1>Blowfish.c
1>Aestab.c
1>Aeskey.c
1>Generating Code...
1>Creating library...
1>Build log was saved at "file://c:\unzipped\tc\Crypto\Release\BuildLog.htm"
1>Crypto - 0 error(s), 0 warning(s)

它只是挂起。它没有使用任何 CPU,IDE 似乎不知道它失败或停止了。再次运行时,我得到了这个

1>------ Build started: Project: Boot, Configuration: Release Win32 ------
2>------ Build started: Project: Driver, Configuration: Release Win32 ------
1>Performing Makefile project actions
2>Performing Makefile project actions
2>------ Building truecrypt.sys: Release x86 ------
1>Microsoft (R) C/C++ Optimizing Compiler Version 8.00c    
1>Copyright (c) Microsoft Corp 1984-1993. All rights reserved.
2>The syntax of the command is incorrect.

我已经安装了 msvc2012,所以我也试过了。我遇到同样的问题

1>------ Build started: Project: Crypto, Configuration: Release Win32 ------
2>------ Build started: Project: Boot, Configuration: Release Win32 ------
3>------ Build started: Project: Driver, Configuration: Release Win32 ------
1>  Performing Custom Build Tools
1>  Aes_hw_cpu.asm 
3>  ------ Building truecrypt.sys: Release x86 ------
2>  Microsoft (R) C/C++ Optimizing Compiler Version 8.00c    
2>  Copyright (c) Microsoft Corp 1984-1993. All rights reserved.
2>  
3>  The syntax of the command is incorrect.
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "echo ------ Building truecrypt.sys: Release x86 ------
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: cmd.exe /c BuildDriver.cmd -build -release -x86 "C:\unzipped\tc\\Common" "C:\unzipped\tc\\Crypto" "C:\unzipped\tc\Driver\"
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: if errorlevel 1 exit %errorlevel%
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: echo.
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: echo ------ Building truecrypt.sys: Release x64 ------
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: BuildDriver.cmd -build -release -x64 "C:\unzipped\tc\\Common" "C:\unzipped\tc\\Crypto" "C:\unzipped\tc\Driver\"" exited with code 255.
1>  Performing Custom Build Tools
1>  Aes_x86.asm 
1>  Aeskey.c
1>  Aestab.c
1>  Blowfish.c
1>  Cast.c
1>  Des.c
1>  Rmd160.c
1>  Serpent.c
1>  Sha1.c
1>  Sha2.c
1>  Twofish.c
1>  Whirlpool.c
1>  Generating Code...
1>  Crypto.vcxproj -> C:\unzipped\tc\Crypto\Release\Crypto.lib

当我再次取消/构建时,我得到以下信息

1>------ Build started: Project: Boot, Configuration: Release Win32 ------
2>------ Build started: Project: Driver, Configuration: Release Win32 ------
2>  ------ Building truecrypt.sys: Release x86 ------
2>  The syntax of the command is incorrect.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "echo ------ Building truecrypt.sys: Release x86 ------
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: cmd.exe /c BuildDriver.cmd -build -release -x86 "C:\unzipped\tc\\Common" "C:\unzipped\tc\\Crypto" "C:\unzipped\tc\Driver\"
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: if errorlevel 1 exit %errorlevel%
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: echo.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: echo ------ Building truecrypt.sys: Release x64 ------
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: BuildDriver.cmd -build -release -x64 "C:\unzipped\tc\\Common" "C:\unzipped\tc\\Crypto" "C:\unzipped\tc\Driver\"" exited with code 255.
1>  Microsoft (R) C/C++ Optimizing Compiler Version 8.00c    
1>  Copyright (c) Microsoft Corp 1984-1993. All rights reserved.
1>  

这里有什么问题?如何构建 TrueCrypt?我正在运行 Windows 7 64 位

4

3 回答 3

33

我可以从https://github.com/syglug/truecrypt成功构建所有项目。我主要遵循readme.txt的说明。因为说明不够详细,所以我在下面描述了我所做的所有步骤。如果您对某些步骤有其他疑问,我将提供其他详细信息。

我使用了安装在 Windows 7 X64 上的 Visual Studio 2008。如果需要,我可以使用 Visual Studio 2010 或 2012 重现相同的内容。

  1. 我从 MSDN 下载(我有订阅)Visual C++ 1.52: en_vc152.exe。它是自解压的EXE文件。MSVC15为了保持路径大多很短,并且在我直接提取的目录名称中没有空格C:\。所以我有例如 16 位 VC 编译器的旧二进制文件C:\MSVC15\BIN
  2. 我将从ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20下载的所有文件放在目录中C:\PKCS-11。像所有依赖文件一样的C:\PKCS-11\pkcs11.h文件将位于同一目录中C:\PKCS-11
  3. 我从http://www.nasm.us/pub/nasm/releasebuilds/2.10.05/下载了NASM的当前版本 2.10.05 。我在目录中提取了 nasm-2.10.05-win32.zip 。所以可以在.C:\nasm-2.10.05nasm.exeC:\nasm-2.10.05
  4. 我下载了适用于 Windows的Gzip二进制文件。我提取到. 所以包含.gzip-1.3.12-1-bin.zipC:\gzip-1.3.12-1-binC:\gzip-1.3.12-1-bin\bingzip.exe
  5. 我之前已经在目录中安装了 Windows DDK C:\WinDDK\7600.16385.1
  6. 我从https://github.com/syglug/truecrypt下载了 truecrypt-master.zip。我将它提取到目录中。这样就可以在目录中找到。C:\truecrypt-masterCrypto.vcprojC:\truecrypt-master\Crypto

因为我不喜欢修改全局环境变量,所以我创建了以下批处理文件:

SET MSVC16_ROOT=C:\MSVC15
SET PKCS11_INC=C:\PKCS-11
PATH=C:\nasm-2.10.05;C:\gzip-1.3.12-1-bin\bin;%PATH%
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"

在批处理文件的最后一行,将启动 Visual Studio 2008 ( devenv.exe)。它继承了 CMD.EXE(启动 Visual Studio 2008 的父进程)中设置的所有环境变量。

自述文件中描述的解决方案文件“TrueCrypt.sln”不包含在github上的源代码中。因此,我打开了在子目录中找到的每个项目文件C:\truecrypt-master并对其进行了编译。它是Crypto.vcproj(从C:\truecrypt-master\Crypto),Boot.vcproj(从C:\truecrypt-master\Boot\Windows),Driver.vcproj(从C:\truecrypt-master\Driver),Format.vcproj(从C:\truecrypt-master\Format)和Mount.vcproj(从C:\truecrypt-master\Mount)。

我可以成功编译所有项目。唯一的小问题是在构建Format.vcprojMount.sln. 文件Format.tlbMount.tlb存在于子目录中。所以我修复了引用 TLB 文件的C:\truecrypt-master\Format\Format.rcC:\truecrypt-master\Mount\Mount.rc

IDR_FORMAT_TLB          TYPELIB                 ".\\Format\\Format.tlb"

IDR_MOUNT_TLB           TYPELIB                 ".\\Mount\\Mount.tlb"

稍后我会以 Pull Request 的形式将相应的修复程序发布到https://github.com/syglug/truecrypt

更新:必须在文件中更改BuildDriver.cmd该行

set TC_BUILD_ARCH=x64 WNET

set TC_BUILD_ARCH=x64

能够构建驱动程序。

此外,构建行应该使用正确的路径,例如"$(SolutionDir)..\Crypto""$(SolutionDir)..\Common"(请参阅 Visual Studio 中的 nmake 选项)。如果不需要使用它TrueCrypt.slnC:\TrueCrypt7.1a

更新 2:编译项目后,您将C:\TrueCrypt7.1a\Release\Setup Files在文件中或C:\truecrypt-master\Release\Setup Files文件中看到

在此处输入图像描述

该文件TrueCrypt Setup.exe仅存在于(从您稍后在评论中发布C:\TrueCrypt7.1a的链接www.truecrypt.org下载)。正如我在评论中提到的,您需要将 Visual Studio 2008 配置为使用 Windows SDK 7 而不是默认的 6.0a 才能成功编译安装项目。

将要编译的驱动程序使用 Microsoft 签名进行数字签名。因此,Windows 7 默认不信任驱动程序。因此,要验证驱动程序是否正常工作,您必须F8在计算机启动期间按下并禁用驱动程序签名:

在此处输入图像描述

之后,您将能够执行TrueCrypt.exe(例如从C:\TrueCrypt7.1a\Release\Setup Files目录)。你会收到警告

在此处输入图像描述

但是TrueCrypt.exe会起作用,你会看到

在此处输入图像描述

于 2012-11-16T09:54:42.413 回答
2

看起来您已修改 PATH 环境变量,并且某些文件夹路径包含引号 ("") 标记。Windows 不再需要引号以避免与空格混淆。错误 PRJ0002:从“C:\Windows\SysWow64\cmd.exe”返回的错误结果 255”在修复此问题后消失。

于 2012-11-16T08:37:01.307 回答
1

对于陷入此 PKEY_AppUserModel_ID 问题的每个人:它通过在第一个函数()之前在 Setup.c 中定义以下内容来工作:

EXTERN_C const PROPERTYKEY DECLSPEC_SELECTANY PKEY_AppUserModel_ID =
{ { 0x9F4C2855, 0x9F79, 0x4B39,
{ 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, } }, 5 };

亲切的问候

于 2013-04-06T18:53:59.237 回答