wok-next rev 20036

Fix truecrypt. Although cryptography is not easy. Use it at your own risk.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sun Oct 22 19:31:48 2017 +0300 (2017-10-22)
parents 0b1827e0934d
children 580f079006a8
files truecrypt/receipt truecrypt/stuff/16.png truecrypt/stuff/48.png truecrypt/stuff/patches/fix-invalid-characters.patch truecrypt/stuff/patches/gcc6.patch truecrypt/stuff/patches/no-exec-stack.patch truecrypt/stuff/patches/series truecrypt/stuff/patches/truecrypt-arch-detection.patch truecrypt/stuff/patches/wxwidgets3.patch truecrypt/stuff/patches/xdg-open.patch truecrypt/stuff/truecrypt.desktop
line diff
     1.1 --- a/truecrypt/receipt	Sun Oct 22 19:26:43 2017 +0300
     1.2 +++ b/truecrypt/receipt	Sun Oct 22 19:31:48 2017 +0300
     1.3 @@ -1,4 +1,4 @@
     1.4 -# SliTaz package receipt.
     1.5 +# SliTaz package receipt v2.
     1.6  
     1.7  PACKAGE="truecrypt"
     1.8  VERSION="7.1a"
     1.9 @@ -6,33 +6,38 @@
    1.10  SHORT_DESC="Free open-source cross-platform disk encryption software"
    1.11  MAINTAINER="slaxemulator@gmail.com"
    1.12  LICENSE="other"
    1.13 +WEB_SITE="http://www.truecrypt.org/"
    1.14 +
    1.15  TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.16 -WEB_SITE="http://www.truecrypt.org"
    1.17 -WGET_URL="ftp://ftp.archlinux.org/other/tc/$TARBALL"
    1.18 +WGET_URL="https://sources.archlinux.org/other/tc/$TARBALL"
    1.19 +TARBALL_SHA512="b5e766023168015cb91bfd85c9e2621055dd98408215e02704775861b5070c5a0234a00c64c1bf7faa34e6d0b51ac71cd36169dd7a6f84d7a34ad0cfa304796a"
    1.20  
    1.21 -DEPENDS="fuse wxWidgets28 xorg-libSM dmsetup linux-md"
    1.22  BUILD_DEPENDS="pkcs nasm fuse-dev wxWidgets28-dev xorg-libSM-dev"
    1.23  
    1.24  # Rules to configure and make the package.
    1.25  compile_rules()
    1.26  {
    1.27 -	export CXXFLAGS="-Wno-narrowing"
    1.28 -	sed -i 's/^export LFLAGS :=$/& -Wl,--copy-dt-needed-entries -ldl/' Makefile
    1.29 -	export PKCS11_INC="/usr/include/pkcs"
    1.30 -	cd $src
    1.31 -	make
    1.32 +	make \
    1.33 +		PKCS11_INC="/usr/include/pkcs" \
    1.34 +		WX_CONFIG=/usr/bin/wx-config \
    1.35 +		TC_EXTRA_LFLAGS+="-ldl $LDFLAGS" \
    1.36 +		TC_EXTRA_CXXFLAGS="$CXXFLAGS" \
    1.37 +		TC_EXTRA_CFLAGS="$CFLAGS" || return 1
    1.38 +
    1.39 +	install -Dm 755 Main/truecrypt $install/usr/bin/truecrypt
    1.40 +	install -Dm 644 $stuff/16.png  $install/usr/share/icons/hicolor/16x16/apps/truecrypt.png
    1.41 +	install -Dm 644 $stuff/48.png  $install/usr/share/icons/hicolor/48x48/apps/truecrypt.png
    1.42 +	install -Dm 644 License.txt    $install/usr/share/licenses/truecrypt/License.txt
    1.43 +
    1.44 +	# function `cook_pick_docs` and web interface can't cope with spaces
    1.45 +	mv Release/Setup\ Files/ Release/Setup_Files/
    1.46 +	mv Release/Setup_Files/TrueCrypt\ User\ Guide.pdf Release/Setup_Files/TrueCrypt_User_Guide.pdf
    1.47 +	cook_pick_docs Release/Setup_Files/*
    1.48  }
    1.49  
    1.50  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.51  genpkg_rules()
    1.52  {
    1.53 -	mkdir -p $fs/usr/bin \
    1.54 -		$fs/usr/share/applications \
    1.55 -		$fs/usr/share/pixmaps \
    1.56 -		$fs/usr/share/licenses/$PACKAGE
    1.57 -	cp -a $src/Main/$PACKAGE $fs/usr/bin
    1.58 -	cp -a $stuff/$PACKAGE.desktop $fs/usr/share/applications
    1.59 -	cp -a $src/Resources/Icons/TrueCrypt-48x48.xpm $fs/usr/share/pixmaps/truecrypt.xpm
    1.60 -
    1.61 -	cp -a $src/License.txt $fs/usr/share/licenses/$PACKAGE/License.txt
    1.62 +	copy @std
    1.63 +	DEPENDS="fuse wxWidgets28 xorg-libSM dmsetup linux-md"
    1.64  }
     2.1 Binary file truecrypt/stuff/16.png has changed
     3.1 Binary file truecrypt/stuff/48.png has changed
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/truecrypt/stuff/patches/fix-invalid-characters.patch	Sun Oct 22 19:31:48 2017 +0300
     4.3 @@ -0,0 +1,54 @@
     4.4 +From 646679da4d79bf7f8af22c44c7ae8498086a88a6 Mon Sep 17 00:00:00 2001
     4.5 +From: Mounir IDRASSI <mounir.idrassi@idrix.fr>
     4.6 +Date: Fri, 18 Mar 2016 16:25:48 +0100
     4.7 +Subject: [PATCH] Linux: Completely fix gcc-5 "Invalid characters encountered"
     4.8 + issue on mount. It was caused by an issue of gcc-5 STL implementation that is
     4.9 + causing char* pointers retrieved from std::string using c_str method to
    4.10 + become invalid in the child of a child process (after two fork calls). The
    4.11 + workaround is to first copy the std:string values in the child before calling
    4.12 + the second fork.
    4.13 +
    4.14 +---
    4.15 + src/Platform/Unix/Process.cpp | 24 ++++++++++++++++++++++--
    4.16 + 1 file changed, 22 insertions(+), 2 deletions(-)
    4.17 +
    4.18 +diff --git a/src/Platform/Unix/Process.cpp b/src/Platform/Unix/Process.cpp
    4.19 +index 388bda6..0770364 100644
    4.20 +--- a/src/Platform/Unix/Process.cpp
    4.21 ++++ b/src/Platform/Unix/Process.cpp
    4.22 +@@ -53,13 +53,33 @@ namespace VeraCrypt
    4.23 + 				try
    4.24 + 				{
    4.25 + 					int argIndex = 0;
    4.26 ++					/* Workaround for gcc 5.X issue related to the use of STL (string and list) with muliple fork calls. 
    4.27 ++					 * 
    4.28 ++					 * The char* pointers retrieved from the elements of parameter "arguments" are no longer valid after
    4.29 ++					 * a second fork is called. "arguments" was created in the parent of the current child process.
    4.30 ++					 * 
    4.31 ++					 * The only solution is to copy the elements of "arguments" parameter in a local string array on this 
    4.32 ++					 * child process and then use char* pointers retrieved from this local copies before calling fork. 
    4.33 ++					 * 
    4.34 ++					 * gcc 4.x doesn't suffer from this issue.
    4.35 ++					 * 
    4.36 ++					 */
    4.37 ++					string argsCopy[array_capacity (args)];
    4.38 + 					if (!execFunctor)
    4.39 +-						args[argIndex++] = const_cast <char*> (processName.c_str());
    4.40 ++					{
    4.41 ++						argsCopy[argIndex++] = processName;
    4.42 ++					}
    4.43 + 
    4.44 + 					foreach (const string &arg, arguments)
    4.45 + 					{
    4.46 +-						args[argIndex++] = const_cast <char*> (arg.c_str());
    4.47 ++						argsCopy[argIndex++] = arg;
    4.48 + 					}
    4.49 ++					
    4.50 ++					for (int i = 0; i < argIndex; i++)
    4.51 ++					{
    4.52 ++						args[i] = const_cast <char*> (argsCopy[i].c_str());
    4.53 ++					}
    4.54 ++
    4.55 + 					args[argIndex] = nullptr;
    4.56 + 
    4.57 + 					if (inputData)
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/truecrypt/stuff/patches/gcc6.patch	Sun Oct 22 19:31:48 2017 +0300
     5.3 @@ -0,0 +1,61 @@
     5.4 +--- Main/Resources.cpp	2016-05-16 16:47:35.846462041 +0200
     5.5 ++++ Main/Resources.cpp	2016-05-16 17:12:21.838202520 +0200
     5.6 +@@ -45,13 +45,13 @@
     5.7 + 		strBuf.CopyFrom (res);
     5.8 + 		return string (reinterpret_cast <char *> (strBuf.Ptr()));
     5.9 + #else
    5.10 +-		static const char LanguageXml[] =
    5.11 ++		static byte LanguageXml[] =
    5.12 + 		{
    5.13 + #			include "Common/Language.xml.h"
    5.14 + 			, 0
    5.15 + 		};
    5.16 + 
    5.17 +-		return string (LanguageXml);
    5.18 ++		return string ((const char*) LanguageXml);
    5.19 + #endif
    5.20 + 	}
    5.21 + 
    5.22 +@@ -64,13 +64,13 @@
    5.23 + 		strBuf.CopyFrom (res);
    5.24 + 		return string (reinterpret_cast <char *> (strBuf.Ptr()));
    5.25 + #else
    5.26 +-		static const char License[] =
    5.27 ++		static byte License[] =
    5.28 + 		{
    5.29 + #			include "License.txt.h"
    5.30 + 			, 0
    5.31 + 		};
    5.32 + 
    5.33 +-		return string (License);
    5.34 ++		return string ((const char*) License);
    5.35 + #endif
    5.36 + 	}
    5.37 + 
    5.38 +--- Main/Forms/PreferencesDialog.cpp	2016-05-16 17:14:47.704707908 +0200
    5.39 ++++ Main/Forms/PreferencesDialog.cpp	2016-05-16 17:15:56.927964437 +0200
    5.40 +@@ -414,11 +414,11 @@
    5.41 + 		libExtension = wxDynamicLibrary::CanonicalizeName (L"x");
    5.42 + 
    5.43 + #ifdef TC_MACOSX
    5.44 +-		extensions.push_back (make_pair (L"dylib", LangString["DLL_FILES"]));
    5.45 ++		extensions.push_back (make_pair (L"dylib", static_cast<const wchar_t*>(LangString["DLL_FILES"].wc_str())));
    5.46 + #endif
    5.47 + 		if (!libExtension.empty())
    5.48 + 		{
    5.49 +-			extensions.push_back (make_pair (libExtension.Mid (libExtension.find (L'.') + 1), LangString["DLL_FILES"]));
    5.50 ++			extensions.push_back (make_pair (static_cast<const wchar_t*>(libExtension.Mid (libExtension.find (L'.') + 1).wc_str()), static_cast<const wchar_t*>(LangString["DLL_FILES"].wc_str())));
    5.51 + 			extensions.push_back (make_pair (L"*", L""));
    5.52 + 		}
    5.53 + 
    5.54 +--- Main/GraphicUserInterface.cpp	2016-05-16 17:16:38.724591342 +0200
    5.55 ++++ Main/GraphicUserInterface.cpp	2016-05-16 17:17:09.854562653 +0200
    5.56 +@@ -1445,7 +1445,7 @@
    5.57 + 	FilePath GraphicUserInterface::SelectVolumeFile (wxWindow *parent, bool saveMode, const DirectoryPath &directory) const
    5.58 + 	{
    5.59 + 		list < pair <wstring, wstring> > extensions;
    5.60 +-		extensions.push_back (make_pair (L"tc", LangString["TC_VOLUMES"]));
    5.61 ++		extensions.push_back (make_pair (L"tc", static_cast<const wchar_t*>(LangString["TC_VOLUMES"].wc_str())));
    5.62 + 
    5.63 + 		FilePathList selFiles = Gui->SelectFiles (parent, LangString[saveMode ? "OPEN_NEW_VOLUME" : "OPEN_VOL_TITLE"], saveMode, false, extensions, directory);
    5.64 + 
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/truecrypt/stuff/patches/no-exec-stack.patch	Sun Oct 22 19:31:48 2017 +0300
     6.3 @@ -0,0 +1,60 @@
     6.4 +--- Crypto/Aes_hw_cpu.asm.old	2011-06-01 17:12:53.078000001 -0400
     6.5 ++++ Crypto/Aes_hw_cpu.asm	2011-06-01 17:12:53.080000002 -0400
     6.6 +@@ -328,3 +328,12 @@
     6.7 + 
     6.8 + 
     6.9 + %endif	; __BITS__ != 16
    6.10 ++	%ifidn __OUTPUT_FORMAT__,elf
    6.11 ++	section .note.GNU-stack noalloc noexec nowrite progbits
    6.12 ++	%endif
    6.13 ++	%ifidn __OUTPUT_FORMAT__,elf32
    6.14 ++	section .note.GNU-stack noalloc noexec nowrite progbits
    6.15 ++	%endif
    6.16 ++	%ifidn __OUTPUT_FORMAT__,elf64
    6.17 ++	section .note.GNU-stack noalloc noexec nowrite progbits
    6.18 ++	%endif
    6.19 +--- Crypto/AesSmall_x86.asm.old	2011-06-01 17:12:53.084000002 -0400
    6.20 ++++ Crypto/AesSmall_x86.asm	2011-06-01 17:12:53.086000002 -0400
    6.21 +@@ -1442,3 +1442,12 @@
    6.22 +     db  v8(0xe1),v8(0x69),v8(0x14),v8(0x63),v8(0x55),v8(0x21),v8(0x0c),v8(0x7d)
    6.23 + 
    6.24 + %endif
    6.25 ++	%ifidn __OUTPUT_FORMAT__,elf
    6.26 ++	section .note.GNU-stack noalloc noexec nowrite progbits
    6.27 ++	%endif
    6.28 ++	%ifidn __OUTPUT_FORMAT__,elf32
    6.29 ++	section .note.GNU-stack noalloc noexec nowrite progbits
    6.30 ++	%endif
    6.31 ++	%ifidn __OUTPUT_FORMAT__,elf64
    6.32 ++	section .note.GNU-stack noalloc noexec nowrite progbits
    6.33 ++	%endif
    6.34 +--- Crypto/Aes_x64.asm.old	2011-06-01 17:12:53.090000002 -0400
    6.35 ++++ Crypto/Aes_x64.asm	2011-06-01 17:12:53.092000002 -0400
    6.36 +@@ -905,3 +905,12 @@
    6.37 + %endif
    6.38 + 
    6.39 + %endif
    6.40 ++	%ifidn __OUTPUT_FORMAT__,elf
    6.41 ++	section .note.GNU-stack noalloc noexec nowrite progbits
    6.42 ++	%endif
    6.43 ++	%ifidn __OUTPUT_FORMAT__,elf32
    6.44 ++	section .note.GNU-stack noalloc noexec nowrite progbits
    6.45 ++	%endif
    6.46 ++	%ifidn __OUTPUT_FORMAT__,elf64
    6.47 ++	section .note.GNU-stack noalloc noexec nowrite progbits
    6.48 ++	%endif
    6.49 +--- Crypto/Aes_x86.asm.old	2011-06-01 17:12:53.096000002 -0400
    6.50 ++++ Crypto/Aes_x86.asm	2011-06-01 17:12:53.097000002 -0400
    6.51 +@@ -644,3 +644,12 @@
    6.52 +     do_exit
    6.53 + 
    6.54 + %endif
    6.55 ++	%ifidn __OUTPUT_FORMAT__,elf
    6.56 ++	section .note.GNU-stack noalloc noexec nowrite progbits
    6.57 ++	%endif
    6.58 ++	%ifidn __OUTPUT_FORMAT__,elf32
    6.59 ++	section .note.GNU-stack noalloc noexec nowrite progbits
    6.60 ++	%endif
    6.61 ++	%ifidn __OUTPUT_FORMAT__,elf64
    6.62 ++	section .note.GNU-stack noalloc noexec nowrite progbits
    6.63 ++	%endif
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/truecrypt/stuff/patches/series	Sun Oct 22 19:31:48 2017 +0300
     7.3 @@ -0,0 +1,7 @@
     7.4 +# from https://www.archlinux.org/packages/extra/i686/truecrypt/
     7.5 +-p1|truecrypt-arch-detection.patch
     7.6 +-p0|gcc6.patch
     7.7 +-p2|fix-invalid-characters.patch
     7.8 +-p0|no-exec-stack.patch
     7.9 +#-p2|wxwidgets3.patch
    7.10 +-p2|xdg-open.patch
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/truecrypt/stuff/patches/truecrypt-arch-detection.patch	Sun Oct 22 19:31:48 2017 +0300
     8.3 @@ -0,0 +1,15 @@
     8.4 +diff -urN truecrypt-7.0a-source/Makefile truecrypt-7.0a-source.fixed/Makefile
     8.5 +--- truecrypt-7.0a-source/Makefile	2010-09-05 10:32:10.000000000 -0400
     8.6 ++++ truecrypt-7.0a-source.fixed/Makefile	2011-07-05 21:41:50.296437879 -0400
     8.7 +@@ -120,10 +120,7 @@
     8.8 + 
     8.9 + export CPU_ARCH ?= unknown
    8.10 + 
    8.11 +-ARCH = $(shell uname -p)
    8.12 +-ifeq "$(ARCH)" "unknown"
    8.13 +-	ARCH = $(shell uname -m)
    8.14 +-endif
    8.15 ++ARCH = $(shell uname -m)
    8.16 + 
    8.17 + ifneq (,$(filter i386 i486 i586 i686 x86,$(ARCH)))
    8.18 + 	CPU_ARCH = x86
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/truecrypt/stuff/patches/wxwidgets3.patch	Sun Oct 22 19:31:48 2017 +0300
     9.3 @@ -0,0 +1,249 @@
     9.4 +From 084a8ee85c24fbc7077d6c789c97aacdb31b4e39 Mon Sep 17 00:00:00 2001
     9.5 +From: Mounir IDRASSI <mounir.idrassi@idrix.fr>
     9.6 +Date: Sun, 8 Jun 2014 00:45:49 +0200
     9.7 +Subject: [PATCH] wxWidgets 3.0 compatibility modifications
     9.8 +
     9.9 +---
    9.10 + src/Main/Application.cpp                     |  6 +++---
    9.11 + src/Main/CommandLineInterface.cpp            | 12 ++++++------
    9.12 + src/Main/Forms/MainFrame.cpp                 |  2 +-
    9.13 + src/Main/Forms/SelectDirectoryWizardPage.cpp |  2 +-
    9.14 + src/Main/Forms/SelectDirectoryWizardPage.h   |  2 +-
    9.15 + src/Main/GraphicUserInterface.cpp            |  6 +++---
    9.16 + src/Main/TextUserInterface.cpp               |  2 +-
    9.17 + src/Main/UserPreferences.cpp                 |  2 +-
    9.18 + 8 files changed, 17 insertions(+), 17 deletions(-)
    9.19 +
    9.20 +diff --git a/src/Main/Application.cpp b/src/Main/Application.cpp
    9.21 +index 8c6dea1..2d49169 100644
    9.22 +--- a/src/Main/Application.cpp
    9.23 ++++ b/src/Main/Application.cpp
    9.24 +@@ -36,7 +36,7 @@ namespace TrueCrypt
    9.25 + 
    9.26 + 	FilePath Application::GetConfigFilePath (const wxString &configFileName, bool createConfigDir)
    9.27 + 	{
    9.28 +-		wxStandardPaths stdPaths;
    9.29 ++		wxStandardPaths& stdPaths = wxStandardPaths::Get();
    9.30 + 		DirectoryPath configDir;
    9.31 + 		
    9.32 + 		if (!Core->IsInPortableMode())
    9.33 +@@ -61,12 +61,12 @@ namespace TrueCrypt
    9.34 + 
    9.35 + 	DirectoryPath Application::GetExecutableDirectory ()
    9.36 + 	{
    9.37 +-		return wstring (wxFileName (wxStandardPaths().GetExecutablePath()).GetPath());
    9.38 ++		return wstring (wxFileName (wxStandardPaths::Get().GetExecutablePath()).GetPath());
    9.39 + 	}
    9.40 + 
    9.41 + 	FilePath Application::GetExecutablePath ()
    9.42 + 	{
    9.43 +-		return wstring (wxStandardPaths().GetExecutablePath());
    9.44 ++		return wstring (wxStandardPaths::Get().GetExecutablePath());
    9.45 + 	}
    9.46 + 
    9.47 + 	void Application::Initialize (UserInterfaceType::Enum type)
    9.48 +diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp
    9.49 +index ccb0317..61cbd31 100644
    9.50 +--- a/src/Main/CommandLineInterface.cpp
    9.51 ++++ b/src/Main/CommandLineInterface.cpp
    9.52 +@@ -380,7 +380,7 @@ namespace TrueCrypt
    9.53 + 		ArgQuick = parser.Found (L"quick");
    9.54 + 
    9.55 + 		if (parser.Found (L"random-source", &str))
    9.56 +-			ArgRandomSourcePath = FilesystemPath (str);
    9.57 ++			ArgRandomSourcePath = FilesystemPath (str.wc_str());
    9.58 + 
    9.59 + 		if (parser.Found (L"restore-headers"))
    9.60 + 		{
    9.61 +@@ -471,7 +471,7 @@ namespace TrueCrypt
    9.62 + 
    9.63 + 			if (param1IsFile)
    9.64 + 			{
    9.65 +-				ArgFilePath.reset (new FilePath (parser.GetParam (0)));
    9.66 ++				ArgFilePath.reset (new FilePath (parser.GetParam (0).wc_str()));
    9.67 + 			}
    9.68 + 		}
    9.69 + 
    9.70 +@@ -524,7 +524,7 @@ namespace TrueCrypt
    9.71 + 					arr.Add (L"");
    9.72 + 					continue;
    9.73 + 				}
    9.74 +-				arr.Last() += token.empty() ? L',' : token;
    9.75 ++				arr.Last() += token.empty() ? L"," : token.wc_str();
    9.76 + 			}
    9.77 + 			else
    9.78 + 				arr.Add (token);
    9.79 +@@ -562,12 +562,12 @@ namespace TrueCrypt
    9.80 + 			{
    9.81 + 				filteredVolumes.push_back (volume);
    9.82 + 			}
    9.83 +-			else if (wxString (volume->Path) == pathFilter.GetFullPath())
    9.84 ++			else if (wxString (wstring(volume->Path)) == pathFilter.GetFullPath())
    9.85 + 			{
    9.86 + 				filteredVolumes.push_back (volume);
    9.87 + 			}
    9.88 +-			else if (wxString (volume->MountPoint) == pathFilter.GetFullPath()
    9.89 +-				|| (wxString (volume->MountPoint) + wxFileName::GetPathSeparator()) == pathFilter.GetFullPath())
    9.90 ++			else if (wxString (wstring(volume->MountPoint)) == pathFilter.GetFullPath()
    9.91 ++				|| (wxString (wstring(volume->MountPoint)) + wxFileName::GetPathSeparator()) == pathFilter.GetFullPath())
    9.92 + 			{
    9.93 + 				filteredVolumes.push_back (volume);
    9.94 + 			}
    9.95 +diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
    9.96 +index 6100a7a..3443ea3 100644
    9.97 +--- a/src/Main/Forms/MainFrame.cpp
    9.98 ++++ b/src/Main/Forms/MainFrame.cpp
    9.99 +@@ -828,7 +828,7 @@ namespace TrueCrypt
   9.100 + 			// File-hosted volumes
   9.101 + 			if (!volume->Path.IsDevice() && !mountPoint.IsEmpty())
   9.102 + 			{
   9.103 +-				if (wxString (volume->Path).Upper().StartsWith (wstring (mountPoint).c_str()))
   9.104 ++				if (wxString (wstring(volume->Path)).Upper().StartsWith (wstring (mountPoint).c_str()))
   9.105 + 				{
   9.106 + 					removedVolumes.push_back (volume);
   9.107 + 					continue;
   9.108 +diff --git a/src/Main/Forms/SelectDirectoryWizardPage.cpp b/src/Main/Forms/SelectDirectoryWizardPage.cpp
   9.109 +index a6a3ab0..1299e22 100644
   9.110 +--- a/src/Main/Forms/SelectDirectoryWizardPage.cpp
   9.111 ++++ b/src/Main/Forms/SelectDirectoryWizardPage.cpp
   9.112 +@@ -16,7 +16,7 @@ namespace TrueCrypt
   9.113 + 	{
   9.114 + 		if (!DirectoryTextCtrl->IsEmpty())
   9.115 + 		{
   9.116 +-			return FilesystemPath (DirectoryTextCtrl->GetValue()).IsDirectory();
   9.117 ++			return FilesystemPath (DirectoryTextCtrl->GetValue().wc_str()).IsDirectory();
   9.118 + 		}
   9.119 + 
   9.120 + 		return false;
   9.121 +diff --git a/src/Main/Forms/SelectDirectoryWizardPage.h b/src/Main/Forms/SelectDirectoryWizardPage.h
   9.122 +index 52335fc..2ea8b0d 100644
   9.123 +--- a/src/Main/Forms/SelectDirectoryWizardPage.h
   9.124 ++++ b/src/Main/Forms/SelectDirectoryWizardPage.h
   9.125 +@@ -18,7 +18,7 @@ namespace TrueCrypt
   9.126 + 	public:
   9.127 + 		SelectDirectoryWizardPage (wxPanel* parent) : SelectDirectoryWizardPageBase (parent) { }
   9.128 + 
   9.129 +-		DirectoryPath GetDirectory () const { return DirectoryPath (DirectoryTextCtrl->GetValue()); }
   9.130 ++		DirectoryPath GetDirectory () const { return DirectoryPath (DirectoryTextCtrl->GetValue().wc_str()); }
   9.131 + 		bool IsValid ();
   9.132 + 		void SetDirectory (const DirectoryPath &path) { DirectoryTextCtrl->SetValue (wstring (path)); }
   9.133 + 		void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); }
   9.134 +diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
   9.135 +index 41eb780..64e9e4b 100644
   9.136 +--- a/src/Main/GraphicUserInterface.cpp
   9.137 ++++ b/src/Main/GraphicUserInterface.cpp
   9.138 +@@ -1384,7 +1384,7 @@ namespace TrueCrypt
   9.139 + #else
   9.140 + 			L"",
   9.141 + #endif
   9.142 +-			L"", wxDD_DEFAULT_STYLE | (existingOnly ? wxDD_DIR_MUST_EXIST : 0), wxDefaultPosition, parent));
   9.143 ++			L"", wxDD_DEFAULT_STYLE | (existingOnly ? wxDD_DIR_MUST_EXIST : 0), wxDefaultPosition, parent).wc_str());
   9.144 + 	}
   9.145 + 
   9.146 + 	FilePathList GraphicUserInterface::SelectFiles (wxWindow *parent, const wxString &caption, bool saveMode, bool allowMultiple, const list < pair <wstring, wstring> > &fileExtensions, const DirectoryPath &directory) const
   9.147 +@@ -1428,14 +1428,14 @@ namespace TrueCrypt
   9.148 + 		if (dialog.ShowModal() == wxID_OK)
   9.149 + 		{
   9.150 + 			if (!allowMultiple)
   9.151 +-				files.push_back (make_shared <FilePath> (dialog.GetPath()));
   9.152 ++				files.push_back (make_shared <FilePath> (dialog.GetPath().wc_str()));
   9.153 + 			else
   9.154 + 			{
   9.155 + 				wxArrayString paths;
   9.156 + 				dialog.GetPaths (paths);
   9.157 + 
   9.158 + 				foreach (const wxString &path, paths)
   9.159 +-					files.push_back (make_shared <FilePath> (path));
   9.160 ++					files.push_back (make_shared <FilePath> (path.wc_str()));
   9.161 + 			}
   9.162 + 		}
   9.163 + 
   9.164 +diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
   9.165 +index d9e93e6..c7af099 100644
   9.166 +--- a/src/Main/TextUserInterface.cpp
   9.167 ++++ b/src/Main/TextUserInterface.cpp
   9.168 +@@ -116,7 +116,7 @@ namespace TrueCrypt
   9.169 + 			for (size_t i = 0; i < length && i < VolumePassword::MaxSize; ++i)
   9.170 + 			{
   9.171 + 				passwordBuf[i] = (wchar_t) passwordStr[i];
   9.172 +-				const_cast <wchar_t *> (passwordStr.c_str())[i] = L'X';
   9.173 ++				const_cast <wchar_t *> (passwordStr.wc_str())[i] = L'X';
   9.174 + 			}
   9.175 + 
   9.176 + 			if (verify && verPhase)
   9.177 +diff --git a/src/Main/UserPreferences.cpp b/src/Main/UserPreferences.cpp
   9.178 +index e0e8233..6608f79 100644
   9.179 +--- a/src/Main/UserPreferences.cpp
   9.180 ++++ b/src/Main/UserPreferences.cpp
   9.181 +@@ -219,7 +219,7 @@ namespace TrueCrypt
   9.182 + 
   9.183 + 			foreach_ref (const Keyfile &keyfile, DefaultKeyfiles)
   9.184 + 			{
   9.185 +-				keyfilesXml.InnerNodes.push_back (XmlNode (L"keyfile", wxString (FilesystemPath (keyfile))));
   9.186 ++				keyfilesXml.InnerNodes.push_back (XmlNode (L"keyfile", wxString (wstring(FilesystemPath (keyfile)))));
   9.187 + 			}
   9.188 + 
   9.189 + 			XmlWriter keyfileWriter (keyfilesCfgPath);
   9.190 +--- a/src/Main/Forms/Forms.cpp
   9.191 ++++ b/src/Main/Forms/Forms.cpp
   9.192 +@@ -263,8 +263,6 @@
   9.193 + 	VolumeStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, _("Volume") ), wxVERTICAL );
   9.194 + 	
   9.195 + 	VolumeGridBagSizer = new wxGridBagSizer( 0, 0 );
   9.196 +-	VolumeGridBagSizer->AddGrowableCol( 1 );
   9.197 +-	VolumeGridBagSizer->AddGrowableRow( 0 );
   9.198 + 	VolumeGridBagSizer->SetFlexibleDirection( wxBOTH );
   9.199 + 	VolumeGridBagSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
   9.200 + 	
   9.201 +@@ -307,6 +305,8 @@
   9.202 + 	
   9.203 + 	VolumeGridBagSizer->Add( bSizer21, wxGBPosition( 1, 3 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
   9.204 + 	
   9.205 ++	VolumeGridBagSizer->AddGrowableCol( 1 );
   9.206 ++	VolumeGridBagSizer->AddGrowableRow( 0 );
   9.207 + 	VolumeStaticBoxSizer->Add( VolumeGridBagSizer, 1, wxEXPAND|wxALL, 4 );
   9.208 + 	
   9.209 + 	LowStaticBoxSizer->Add( VolumeStaticBoxSizer, 1, wxEXPAND, 5 );
   9.210 +@@ -1442,7 +1442,6 @@
   9.211 + 	bSizer54->Add( bSizer55, 1, wxEXPAND, 5 );
   9.212 + 	
   9.213 + 	FilesystemOptionsSizer = new wxGridBagSizer( 0, 0 );
   9.214 +-	FilesystemOptionsSizer->AddGrowableCol( 1 );
   9.215 + 	FilesystemOptionsSizer->SetFlexibleDirection( wxBOTH );
   9.216 + 	FilesystemOptionsSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
   9.217 + 	FilesystemOptionsSizer->SetEmptyCellSize( wxSize( 0,0 ) );
   9.218 +@@ -1468,6 +1467,7 @@
   9.219 + 	FilesystemOptionsTextCtrl = new wxTextCtrl( m_panel8, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
   9.220 + 	FilesystemOptionsSizer->Add( FilesystemOptionsTextCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
   9.221 + 	
   9.222 ++	FilesystemOptionsSizer->AddGrowableCol( 1 );
   9.223 + 	bSizer54->Add( FilesystemOptionsSizer, 0, wxEXPAND, 5 );
   9.224 + 	
   9.225 + 	sbSizer28->Add( bSizer54, 0, wxEXPAND|wxBOTTOM, 5 );
   9.226 +@@ -2892,7 +2892,6 @@
   9.227 + 	bSizer7 = new wxBoxSizer( wxVERTICAL );
   9.228 + 	
   9.229 + 	GridBagSizer = new wxGridBagSizer( 0, 0 );
   9.230 +-	GridBagSizer->AddGrowableCol( 1 );
   9.231 + 	GridBagSizer->SetFlexibleDirection( wxBOTH );
   9.232 + 	GridBagSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
   9.233 + 	GridBagSizer->SetEmptyCellSize( wxSize( 0,0 ) );
   9.234 +@@ -2950,6 +2949,7 @@
   9.235 + 	
   9.236 + 	GridBagSizer->Add( PasswordPlaceholderSizer, wxGBPosition( 8, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxEXPAND, 5 );
   9.237 + 	
   9.238 ++	GridBagSizer->AddGrowableCol( 1 );
   9.239 + 	bSizer7->Add( GridBagSizer, 1, wxALL|wxEXPAND, 5 );
   9.240 + 	
   9.241 + 	this->SetSizer( bSizer7 );
   9.242 +--- a/src/Main/Forms/PreferencesDialog.h
   9.243 ++++ b/src/Main/Forms/PreferencesDialog.h
   9.244 +@@ -26,7 +26,7 @@ namespace VeraCrypt
   9.245 + 	protected:
   9.246 + 		void OnAssignHotkeyButtonClick (wxCommandEvent& event);
   9.247 + 		void OnBackgroundTaskEnabledCheckBoxClick (wxCommandEvent& event);
   9.248 +-		void OnCancelButtonClick (wxCommandEvent& event) { Close(); }
   9.249 ++		void OnCancelButtonClick (wxCommandEvent& event) { EndModal (wxID_CANCEL); }
   9.250 + 		void OnClose (wxCloseEvent& event);
   9.251 + 		void OnDismountOnPowerSavingCheckBoxClick (wxCommandEvent& event);
   9.252 + 		void OnDismountOnScreenSaverCheckBoxClick (wxCommandEvent& event);
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/truecrypt/stuff/patches/xdg-open.patch	Sun Oct 22 19:31:48 2017 +0300
    10.3 @@ -0,0 +1,81 @@
    10.4 +From ad4af09d884e1727750571f7679e8679b8027a1c Mon Sep 17 00:00:00 2001
    10.5 +From: Mounir IDRASSI <mounir.idrassi@idrix.fr>
    10.6 +Date: Sun, 8 Feb 2015 13:45:15 +0100
    10.7 +Subject: [PATCH] Linux: When not under Gnome/KDE, use xdg-open to open the
    10.8 + mounted volume if it is available.
    10.9 +
   10.10 +---
   10.11 + src/Main/UserInterface.cpp | 18 +++++++++++++++++-
   10.12 + 1 file changed, 17 insertions(+), 1 deletion(-)
   10.13 +
   10.14 +diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp
   10.15 +index 177a4e9..39c4274 100644
   10.16 +--- a/src/Main/UserInterface.cpp
   10.17 ++++ b/src/Main/UserInterface.cpp
   10.18 +@@ -832,7 +832,7 @@ namespace VeraCrypt
   10.19 + 		// MIME handler for directory seems to be unavailable through wxWidgets
   10.20 + 		wxString desktop = GetTraits()->GetDesktopEnvironment();
   10.21 + 
   10.22 +-		if (desktop == L"GNOME" || desktop.empty())
   10.23 ++		if (desktop == L"GNOME")
   10.24 + 		{
   10.25 + 			args.push_back ("--no-default-window");
   10.26 + 			args.push_back ("--no-desktop");
   10.27 +@@ -865,6 +865,22 @@ namespace VeraCrypt
   10.28 + 				catch (exception &e) { ShowError (e); }
   10.29 + 			}
   10.30 + 		}
   10.31 ++		else if (wxFileName::IsFileExecutable (wxT("/usr/bin/xdg-open")))
   10.32 ++		{
   10.33 ++			// Fallback on the standard xdg-open command 
   10.34 ++			// which is not always available by default
   10.35 ++			args.push_back (string (path));
   10.36 ++			try
   10.37 ++			{
   10.38 ++				Process::Execute ("xdg-open", args, 2000);
   10.39 ++			}
   10.40 ++			catch (TimeOut&) { }
   10.41 ++			catch (exception &e) { ShowError (e); }
   10.42 ++		}
   10.43 ++		else
   10.44 ++		{
   10.45 ++			ShowWarning (wxT("Unable to find a file manager to open the mounted volume"));
   10.46 ++		}
   10.47 + #endif
   10.48 + 	}
   10.49 + 
   10.50 +From 3a9db8d98c1301726bdf26af9698e7cc61a46f71 Mon Sep 17 00:00:00 2001
   10.51 +From: Mounir IDRASSI <mounir.idrassi@idrix.fr>
   10.52 +Date: Wed, 2 Dec 2015 11:10:30 +0100
   10.53 +Subject: [PATCH] Linux: fix Nautilus not detected as file manager on some
   10.54 + Gnome based destributions.
   10.55 +
   10.56 +---
   10.57 + src/Main/UserInterface.cpp | 6 ++++--
   10.58 + 1 file changed, 4 insertions(+), 2 deletions(-)
   10.59 +
   10.60 +diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp
   10.61 +index 73c9914..2be5bc7 100644
   10.62 +--- a/src/Main/UserInterface.cpp
   10.63 ++++ b/src/Main/UserInterface.cpp
   10.64 +@@ -834,8 +834,10 @@ namespace VeraCrypt
   10.65 + #else
   10.66 + 		// MIME handler for directory seems to be unavailable through wxWidgets
   10.67 + 		wxString desktop = GetTraits()->GetDesktopEnvironment();
   10.68 ++		bool xdgOpenPresent = wxFileName::IsFileExecutable (wxT("/usr/bin/xdg-open"));
   10.69 ++		bool nautilusPresent = wxFileName::IsFileExecutable (wxT("/usr/bin/nautilus"));
   10.70 + 
   10.71 +-		if (desktop == L"GNOME")
   10.72 ++		if (desktop == L"GNOME" || (desktop.empty() && !xdgOpenPresent && nautilusPresent))
   10.73 + 		{
   10.74 + 			args.push_back ("--no-default-window");
   10.75 + 			args.push_back ("--no-desktop");
   10.76 +@@ -868,7 +870,7 @@ namespace VeraCrypt
   10.77 + 				catch (exception &e) { ShowError (e); }
   10.78 + 			}
   10.79 + 		}
   10.80 +-		else if (wxFileName::IsFileExecutable (wxT("/usr/bin/xdg-open")))
   10.81 ++		else if (xdgOpenPresent)
   10.82 + 		{
   10.83 + 			// Fallback on the standard xdg-open command 
   10.84 + 			// which is not always available by default
    11.1 --- a/truecrypt/stuff/truecrypt.desktop	Sun Oct 22 19:26:43 2017 +0300
    11.2 +++ b/truecrypt/stuff/truecrypt.desktop	Sun Oct 22 19:31:48 2017 +0300
    11.3 @@ -1,9 +1,9 @@
    11.4  [Desktop Entry]
    11.5  Type=Application
    11.6 +Name=TrueCrypt
    11.7 +Comment=On-the-fly encryption
    11.8 +StartupNotify=true
    11.9  Exec=truecrypt
   11.10  Icon=truecrypt
   11.11 -Comment=On-the-fly encryption
   11.12  Terminal=false
   11.13 -Name=TrueCrypt
   11.14 -StartupNotify=true
   11.15  Categories=System;