How do I build TrueCrypt on Windows? - truecrypt

I'm trying to compile TrueCrypt. I am using the instructions from https://github.com/syglug/truecrypt.
I set the 3 environment variables (pkcs,ddk,MSVC16_ROOT) and opened the project in msvc2008. This wasn't in the instructions but I needed NASM to be installed so I installed it and put NASM in the PATH. Now when I build I get the below. It juts ends even though the IDE has the cancel build selectable the compiler isn't doing anything and the system idles.
Crypto.lib does exist after this step
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)
It just hangs. It isn't using any CPU the IDE doesn't seem to know it failed or stopped. When running again I get this
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.
I have msvc2012 installed so I tried it as well. I get the same problems
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
When I cancel/build again I get the below
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>
What's wrong here? How do I build TrueCrypt? I'm running Windows 7 64bits

I could successfully build all projects from https://github.com/syglug/truecrypt. I followed mostly the instructions from readme.txt. Because the instruction are not detailed enough I describe below all steps which I did. If you will have some additional questions to some steps I'll include additional details.
I used Visual Studio 2008 installed on Windows 7 X64. If needed I could reproduce the same with Visual Studio 2010 or 2012.
I downloaded from MSDN (I have subscription) Visual C++ 1.52: en_vc152.exe. It's self extracted EXE file. To hold Paths mostly short and have no spaces in the directory names I extracted MSVC15 directly in C:\. So I had for example old binaries of 16-bit VC compiler in C:\MSVC15\BIN.
I placed all files downloaded from ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20 in C:\PKCS-11 directory. The file C:\PKCS-11\pkcs11.h like all dependent files will be in the same directory C:\PKCS-11
I downloaded the current version 2.10.05 of NASM from http://www.nasm.us/pub/nasm/releasebuilds/2.10.05/. I extracted nasm-2.10.05-win32.zip in C:\nasm-2.10.05 directory. So that nasm.exe could be found in C:\nasm-2.10.05.
I downloaded Binaries of Gzip for Windows. I extracted gzip-1.3.12-1-bin.zip to C:\gzip-1.3.12-1-bin. So that C:\gzip-1.3.12-1-bin\bin contains gzip.exe.
I had already installed Windows DDK in directory C:\WinDDK\7600.16385.1 before.
I downloaded truecrypt-master.zip from https://github.com/syglug/truecrypt. I extracted it in C:\truecrypt-master directory. So that Crypto.vcproj can be found in C:\truecrypt-master\Crypto directory.
Because I don't like to modify the global environment variables I created the following batch file:
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"
In the last line of the batch file Visual Studio 2008 will be started (devenv.exe). It inherits all environment variables set in CMD.EXE (the parent process which started Visual Studio 2008).
The solution file 'TrueCrypt.sln' described in the readme is not included in the sources found on github. So I opened every Project file which I found in subdirectories of C:\truecrypt-master and compiled it. It was Crypto.vcproj (from C:\truecrypt-master\Crypto), Boot.vcproj (from C:\truecrypt-master\Boot\Windows), Driver.vcproj (from C:\truecrypt-master\Driver), Format.vcproj (from C:\truecrypt-master\Format) and Mount.vcproj (from C:\truecrypt-master\Mount).
I could successfully compile all the projects. The only small problems were during building of Format.vcproj and Mount.sln. The files Format.tlb and Mount.tlb exists in subdirectories. So I fixed the lines where TLB files are referenced in C:\truecrypt-master\Format\Format.rc and C:\truecrypt-master\Mount\Mount.rc to
IDR_FORMAT_TLB TYPELIB ".\\Format\\Format.tlb"
and
IDR_MOUNT_TLB TYPELIB ".\\Mount\\Mount.tlb"
I'll post later the corresponded fixes to https://github.com/syglug/truecrypt in form of Pull Request.
UPDATED: One have to change in the file BuildDriver.cmd the line
set TC_BUILD_ARCH=x64 WNET
to
set TC_BUILD_ARCH=x64
to be able to build Driver.
Additionally one should build lines uses correct pathes like "$(SolutionDir)..\Crypto" and "$(SolutionDir)..\Common" (see nmake options in Visual Studio). If one use TrueCrypt.sln from C:\TrueCrypt7.1a it's not needed.
UPDATED 2: After you compiled the project you will see in C:\TrueCrypt7.1a\Release\Setup Files or in C:\truecrypt-master\Release\Setup Files the files
The file TrueCrypt Setup.exe exists only in C:\TrueCrypt7.1a (downloaded from the link www.truecrypt.org which you posted in the comment later). As I mentioned in the comment before you need configure Visual Studio 2008 to use Windows SDK 7 instead of default 6.0a to be able successfully to compile Setup project.
The drivers which will be compiled are not digitaly signed with Microsoft signature. So the drivers will be not trusted by Windows 7 by default. So to verify that the driver work you have to press F8 during boot of the computer and disable driver signature:
After that you will be able to execute TrueCrypt.exe (from C:\TrueCrypt7.1a\Release\Setup Files directory for example). You will get warning
but the TrueCrypt.exe will do work and you will see

Looks like you have modified the PATH environment variable and some folder path contains quotation ("") marks. Windows no longer needs quotes to avoid getting confused with spaces. Error PRJ0002 : Error result 255 returned from 'C:\Windows\SysWow64\cmd.exe'" goes away once you fix this.

For everyone who gets stuck in this PKEY_AppUserModel_ID problem: it works by defining the following in Setup.c before the first function():
EXTERN_C const PROPERTYKEY DECLSPEC_SELECTANY PKEY_AppUserModel_ID =
{ { 0x9F4C2855, 0x9F79, 0x4B39,
{ 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, } }, 5 };
kind regards

Related

I'm Trying to use VTK with Qt using CMake and Visual Studio, and get this Error while building fatal error -> Byte order of target CPU unknown

My os is windows running on parallels Desktop app on Mac M2
When I Try to build the libraries I get this error
fatal error C1189: #error: "Byte order of target CPU unknown."
This is what I got in the console of VS when I finished installing
274>------ Build started: Project: ALL_BUILD, Configuration: Release ARM64 ------ 274>Building Custom Rule C:/VTK-9.2.2/src/CMakeLists.txt ========== Build: 157 succeeded, 117 failed, 0 up-to-date, 0 skipped ========== ========== Elapsed 11:48.565 ==========
If you are using an old (<2.8 cmake, this can be the issue): https://cmake.org/Bug/view.php?id=13808
In any case, you might try to set the byte-order manually in your cmake file:
set( CMAKE_CXX_BYTE_ORDER BIG_ENDIAN)
You could also check that CMAKE_OSX_ARCHITECTURES only specify one architecture or all architectures shares the same byte-order.

vs2019 wxwidgets sample hello world -> "wxstrcoll not found"

Seems like many people hit this and there seems to be no solution that I can find.
Follow exact instructions, downloaded precompiled libs, v 3.0.5 - latest stable build
set wxwin env var
make new 32bit empty project
copy the hello world app into new source file
set additional include
set preproc defintions -> UNICODE & _UNICODE on
set linker libs
build ->
1>------ Build started: Project: wxtest, Configuration: Debug Win32 ------
1>Source.cpp
1>c:\work\wxwin\include\wx\wxcrt.h(487): error C3861: 'wxStrcoll': identifier not found
1>c:\work\wxwin\include\wx\wxcrt.h(487): message : 'wxStrcoll': function was not declared in the template definition context and can be found only via argument-dependent lookup in the instantiation context
1>c:\work\wxwin\include\wx\wxcrt.h(496): message : see reference to function template instantiation 'int wxStrcoll_String<const wchar_t*>(const wxString &,const T &)' being compiled
1> with
1> [
1> T=const wchar_t *
1> ]
1>Done building project "wxtest.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Unfortunately you need to manually modify the header to fix the build with MSVS 2019 in 3.0.5 and remove defined(__VISUALC__) || part of the check before wxNEEDS_DECL_BEFORE_TEMPLATE definition in wx/wxcrt.h.
FWIW this problem was fixed since a long time (~6 years) in wx 3.1 and you can compile 3.1.3 or the soon to be released 3.1.4 out of the box with MSVS 2019.

Cannot find KRE package kre-clr-win-x86.1.0.0-beta3, Visual Studio 2015 CTP 6

I installed Visual Studio 2015 CTP 6, I create a ASP.NET MVC 6 project and i receive following error at build:
1>------ Build started: Project: Test, Configuration: Debug Any CPU ------
1> Cannot find KRE package kre-clr-win-x86.1.0.0-beta3 in the folder: C:\Users\cornel.adavidoaiei\.k\runtimes
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AspNet\Microsoft.Web.AspNet.targets(111,5): error : The ProjectK Runtime package needs to be installed. See output window for more details.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
I am looking in "C:\Users\cornel.adavidoaiei.k\runtimes\kre-clr-win-x86.1.0.0-beta3" and it isn't any bin here but i have bin in "C:\Users\cornel.adavidoaiei.k\runtimes\kre-clr-win-x64.1.0.0-beta3", why doesn't use x64 version which is installed and try to use x86 version of kre which is missing, any idea how could to solve this issue ?

Moving solutions from 32bit XP to 64bit Win7 --> compile error

I developed some solutions (C#, VB.Net) with VS2008/VS2010 on a XP-computer (32bit). The solutions uses .NET Framework 2.0 and 3.5 and references to 32bit Com-objects (dll, exe). The solutions are compiled with build-setting release+x86. This worked fine.
Now I moved the solutions to a new computer with 64bit Windows7 and VS2010 Premium. Now I'm getting the following error when building the solutions.
This is the complete error message:
------ Rebuild All started: Project: IXDokService, Configuration: Release x86 ------
TlbImp : error TI0000: The input file 'C:\Program Files (x86)\DSA\JetOffice Workflow\bin32\wrkflw32.exe' is not a valid type library.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1558,9): warning MSB3283: Cannot find wrapper assembly for type library "JetOfficeWorkflow".
------ Starting pre-build validation for project 'IXDokServiceWebSetup' ------
ERROR: An error occurred while validating. HRESULT = '80004005'
------ Pre-build validation for project 'IXDokServiceWebSetup' completed ------
------ Rebuild All started: Project: IXDokServiceWebSetup, Configuration: Release ------
========== Rebuild All: 0 succeeded, 2 failed, 0 skipped ==========
wrkflw32.exe is a 32bit-exe (COM). When I'm changing the .NET Framework Version to 4 then the building process of the solution runs successfully.
But I don't want to change the .NET Framework version. Has someone an idea for me?

Issues with running nunit-console.exe with Mono

I could make a dll for NUnit NUnit test under mono, but when I tried to run in with nunit-console.exe I get the following error message.
Runtime Environment -
OS Version: Unix 10.3.0.0
CLR Version: 2.0.50727.1433 ( 2.6.4 (tarball Thu Apr 22 13:24:33 MDT 2010) )
ProcessModel: Default DomainUsage: Single
Execution Runtime: mono-2.0
** (/Users/smcho/bin/NUnit-2.5.5.10112/bin/net-2.0/nunit-console.exe:36800): WARNING **: The following assembly referenced from /private/var/folders/m4/m4u1hmP+FHOQaiZbHj1UCk+++TI/-Tmp-/nunit20/ShadowCopyCache/36800_634111616836311880/Tests_-22323139/assembly/shadow/54274fc2/118e035c_45a94c9e_00000001/mut.dll could not be loaded:
Assembly: nunit.framework (assemblyref_index=1)
Version: 2.5.5.10112
Public Key: 96d09a1eb7f44a77
System error: Invalid argument
** (/Users/smcho/bin/NUnit-2.5.5.10112/bin/net-2.0/nunit-console.exe:36800): WARNING **: Could not load file or assembly 'nunit.framework, Version=2.5.5.10112, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies.
What might be wrong? I have nunit.framework.dll under /Users/smcho/bin/NUnit-2.5.5.10112/bin/net-2.0/framework, but it doesn't seem to know about this.
This is another frustrating point about using NUnit in Mono. As far as I've been able to tell, you need to have all of those missing files (there will be more than just nunit.framework.dll) in the same directory as nunit-console.exe.
There might be a command line option either in mono or nunit-console.exe to specify another directory to search for missing DLLs -- I'm not sure. Barring that, you'll have to copy the missing DLLs into the same folder as nunit-console.exe, or you'll have to cd into the framework folder and use mono ../nunit-console.exe /path/to/my/tests.dll
Once nuget is installed, you can use it to install nunit.console like so:
(This is from my .circlci/config.yml file)
- run: mono --runtime=v4.0 nuget.exe install nunit.console
- run: msbuild MySolution.sln
- run: mono --runtime=v4.0 NUnit.ConsoleRunner.3.12.0/tools/nunit3-console.exe FirstModule.Tests/bin/Debug/FirstModule.Tests.dll
- run: mono --runtime=v4.0 NUnit.ConsoleRunner.3.12.0/tools/nunit3-console.exe SecondModule.Tests/bin/Debug/SecondModule.Tests.dll
The trick is to specify the entire path for the NUnit.ConsoleRunner and to watchout for the - changing into a . by version 3