VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Application.cpp
blob: e579142bd55220e3775d73c437712312ed07d295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved.

 Governed by the TrueCrypt License 3.0 the full text of which is contained in
 the file License.txt included in TrueCrypt binary and source code distribution
 packages.
*/

#include "System.h"
#include <wx/stdpaths.h>
#include "Main.h"
#include "Application.h"
#include "CommandLineInterface.h"
#ifndef TC_NO_GUI
#include "GraphicUserInterface.h"
#endif
#include "TextUserInterface.h"

namespace VeraCrypt
{
	wxApp* Application::CreateConsoleApp ()
	{
		mUserInterface = new TextUserInterface;
		mUserInterfaceType = UserInterfaceType::Text;
		return mUserInterface;
	} 

#ifndef TC_NO_GUI
	wxApp* Application::CreateGuiApp ()
	{
		mUserInterface = new GraphicUserInterface;
		mUserInterfaceType = UserInterfaceType::Graphic;
		return mUserInterface;
	} 
#endif

	FilePath Application::GetConfigFilePath (const wxString &configFileName, bool createConfigDir)
	{
		DirectoryPath configDir;
		
		if (!Core->IsInPortableMode())
		{
#ifdef TC_MACOSX
			wxFileName configPath (L"~/Library/Application Support/VeraCrypt");
			configPath.Normalize();
			configDir = wstring (configPath.GetFullPath());
#else
			wxStandardPaths& stdPaths = wxStandardPaths::Get();
			configDir = wstring (stdPaths.GetUserDataDir());
#endif
		}
		else
			configDir = GetExecutableDirectory();

		if (createConfigDir && !configDir.IsDirectory())
			Directory::Create (configDir);

		FilePath filePath = wstring (wxFileName (wstring (configDir), configFileName).GetFullPath());
		return filePath;
	}

	DirectoryPath Application::GetExecutableDirectory ()
	{
		return wstring (wxFileName (wxStandardPaths::Get().GetExecutablePath()).GetPath());
	}

	FilePath Application::GetExecutablePath ()
	{
		return wstring (wxStandardPaths::Get().GetExecutablePath());
	}

	void Application::Initialize (UserInterfaceType::Enum type)
	{
		switch (type)
		{
		case UserInterfaceType::Text:
			{
				wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) CreateConsoleApp);
				break;
			}

#ifndef TC_NO_GUI
		case UserInterfaceType::Graphic:
			{
				wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) CreateGuiApp);
				break;
			}
#endif

		default:
			throw ParameterIncorrect (SRC_POS);
		}
	}

	int Application::ExitCode = 0;
	UserInterface *Application::mUserInterface = nullptr;
	UserInterfaceType::Enum Application::mUserInterfaceType;
}
' href='#n522'>522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
	ProjectType="Visual C++"
	Version="9.00"
	Name="Format"
	ProjectGUID="{9DC1ABE2-D18B-48FB-81D2-8C50ADC57BCF}"
	RootNamespace="Format"
	Keyword="Win32Proj"
	TargetFrameworkVersion="131072"
	>
	<Platforms>
		<Platform
			Name="Win32"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Debug|Win32"
			OutputDirectory="Debug"
			IntermediateDirectory="Debug"
			ConfigurationType="1"
			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
			CharacterSet="2"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TypeLibraryName="$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="..\Common;..\Crypto;..\;$(PKCS11_INC)"
				PreprocessorDefinitions="VOLFORMAT;WIN32;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS"
				MinimalRebuild="true"
				BasicRuntimeChecks="3"
				RuntimeLibrary="1"
				BufferSecurityCheck="true"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="4"
				DisableSpecificWarnings="4057;4100;4127;4201;4204;4701;4706"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalDependencies="comctl32.lib setupapi.lib ..\Crypto\Debug\crypto.lib"
				OutputFile="$(OutDir)/VeraCryptFormat.exe"
				LinkIncremental="2"
				GenerateManifest="false"
				IgnoreAllDefaultLibraries="false"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)/Format.pdb"
				SubSystem="2"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="2"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				AdditionalManifestFiles="Format.manifest"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="md &quot;..\Debug\Setup Files&quot; 2&gt;NUL:&#x0D;&#x0A;copy Debug\VeraCryptFormat.exe &quot;..\Debug\Setup Files\VeraCrypt Format.exe&quot; &gt;NUL:&#x0D;&#x0A;"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="Release"
			IntermediateDirectory="Release"
			ConfigurationType="1"
			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
			CharacterSet="2"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TypeLibraryName="$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb"
			/>
			<Tool
				Name="VCCLCompilerTool"
				AdditionalOptions="/w34189"
				Optimization="2"
				AdditionalIncludeDirectories="..\Common;..\Crypto;..\;$(PKCS11_INC)"
				PreprocessorDefinitions="VOLFORMAT;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS"
				RuntimeLibrary="0"
				BufferSecurityCheck="true"
				UsePrecompiledHeader="0"
				AssemblerOutput="2"
				AssemblerListingLocation="$(IntDir)/"
				WarningLevel="4"
				DebugInformationFormat="0"
				DisableSpecificWarnings="4057;4100;4127;4201;4204;4701;4706"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalDependencies="comctl32.lib setupapi.lib ..\Crypto\Release\crypto.lib"
				OutputFile="$(OutDir)/VeraCryptFormat.exe"
				LinkIncremental="1"
				GenerateManifest="false"
				IgnoreAllDefaultLibraries="false"
				GenerateDebugInformation="false"
				GenerateMapFile="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="2"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				AdditionalManifestFiles="Format.manifest"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="copy Release\VeraCryptFormat.exe &quot;..\Release\Setup Files\VeraCrypt Format.exe&quot;"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Source Files"
			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\FormatCom.cpp"
				>
			</File>
			<File
				RelativePath=".\FormatCom.idl"
				>
			</File>
			<File
				RelativePath=".\InPlace.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\Tcformat.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<Filter
				Name="Common"
				>
				<File
					RelativePath="..\Common\BaseCom.cpp"
					>
				</File>
				<File
					RelativePath="..\Common\BootEncryption.cpp"
					>
				</File>
				<File
					RelativePath="..\Common\Cmdline.c"
					>
				</File>
				<File
					RelativePath="..\Common\Combo.c"
					>
				</File>
				<File
					RelativePath="..\Common\Crc.c"
					>
				</File>
				<File
					RelativePath="..\Common\Crypto.c"
					>
				</File>
				<File
					RelativePath="..\Common\Dictionary.c"
					>
					<FileConfiguration
						Name="Debug|Win32"
						>
						<Tool
							Name="VCCLCompilerTool"
							CompileAs="2"
						/>
					</FileConfiguration>
					<FileConfiguration
						Name="Release|Win32"
						>
						<Tool
							Name="VCCLCompilerTool"
							CompileAs="2"
						/>
					</FileConfiguration>
				</File>
				<File
					RelativePath="..\Common\Dlgcode.c"
					>
					<FileConfiguration
						Name="Debug|Win32"
						>
						<Tool
							Name="VCCLCompilerTool"
							CompileAs="2"
						/>
					</FileConfiguration>
					<FileConfiguration
						Name="Release|Win32"
						>
						<Tool
							Name="VCCLCompilerTool"
							CompileAs="2"
						/>
					</FileConfiguration>
				</File>
				<File
					RelativePath="..\Common\EncryptionThreadPool.c"
					>
				</File>
				<File
					RelativePath="..\Common\Endian.c"
					>
				</File>
				<File
					RelativePath="..\Common\Fat.c"
					>
				</File>
				<File
					RelativePath="..\Common\Format.c"
					>
				</File>
				<File
					RelativePath="..\Common\GfMul.c"
					>
				</File>
				<File
					RelativePath="..\Common\Keyfiles.c"
					>
					<FileConfiguration
						Name="Debug|Win32"
						>
						<Tool
							Name="VCCLCompilerTool"
							CompileAs="2"
						/>
					</FileConfiguration>
					<FileConfiguration
						Name="Release|Win32"
						>
						<Tool
							Name="VCCLCompilerTool"
							CompileAs="2"
						/>
					</FileConfiguration>
				</File>
				<File
					RelativePath="..\Common\Language.c"
					>
				</File>
				<File
					RelativePath="..\Common\Password.c"
					>
				</File>
				<File
					RelativePath="..\Common\Pkcs5.c"
					>
				</File>
				<File
					RelativePath="..\Common\Progress.c"
					>
				</File>
				<File
					RelativePath="..\Common\Random.c"
					>
				</File>
				<File
					RelativePath="..\Common\Registry.c"
					>
				</File>
				<File
					RelativePath="..\Common\SecurityToken.cpp"
					>
				</File>
				<File
					RelativePath="..\Common\Tests.c"
					>
				</File>
				<File
					RelativePath="..\Common\Volumes.c"
					>
				</File>
				<File
					RelativePath="..\Common\Wipe.c"
					>
				</File>
				<File
					RelativePath="..\Common\Xml.c"
					>
				</File>
				<File
					RelativePath="..\Common\Xts.c"
					>
				</File>
			</Filter>
		</Filter>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath="..\Common\BaseCom.h"
				>
			</File>
			<File
				RelativePath="..\Common\Common.h"
				>
			</File>
			<File
				RelativePath="..\Common\Crc.h"
				>
			</File>
			<File
				RelativePath="..\Common\Crypto.h"
				>
			</File>
			<File
				RelativePath="..\Common\Dictionary.h"
				>
			</File>
			<File
				RelativePath="..\Common\Dlgcode.h"
				>
			</File>
			<File
				RelativePath="..\Common\EncryptionThreadPool.h"
				>
			</File>
			<File
				RelativePath="..\Common\Endian.h"
				>
			</File>
			<File
				RelativePath="..\Common\Exception.h"
				>
			</File>
			<File
				RelativePath="..\Common\Fat.h"
				>
			</File>
			<File
				RelativePath="..\Common\Format.h"
				>
			</File>
			<File
				RelativePath=".\FormatCom.h"
				>
			</File>
			<File
				RelativePath="..\Common\GfMul.h"
				>
			</File>
			<File
				RelativePath=".\InPlace.h"
				>
			</File>
			<File
				RelativePath="..\Common\Keyfiles.h"
				>
			</File>
			<File
				RelativePath="..\Common\Language.h"
				>
			</File>
			<File
				RelativePath="..\Mount\Mount.h"
				>
			</File>
			<File
				RelativePath="..\Common\Pkcs5.h"
				>
			</File>
			<File
				RelativePath="..\Common\Progress.h"
				>
			</File>
			<File
				RelativePath="..\Common\Random.h"
				>
			</File>
			<File
				RelativePath="..\Common\Registry.h"
				>
			</File>
			<File
				RelativePath=".\resource.h"
				>
			</File>
			<File
				RelativePath="..\Common\Resource.h"
				>
			</File>
			<File
				RelativePath="..\Common\SecurityToken.h"
				>
			</File>
			<File
				RelativePath="..\Common\Tcdefs.h"
				>
			</File>
			<File
				RelativePath=".\Tcformat.h"
				>
			</File>
			<File
				RelativePath="..\Common\Tests.h"
				>
			</File>
			<File
				RelativePath="..\Common\Volumes.h"
				>
			</File>
			<File
				RelativePath="..\Common\Wipe.h"
				>
			</File>
			<File
				RelativePath="..\Common\Xml.h"
				>
			</File>
			<File
				RelativePath="..\Common\Xts.h"
				>
			</File>
		</Filter>
		<Filter
			Name="Resource Files"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
			<File
				RelativePath=".\Format.manifest"
				>
			</File>
			<File
				RelativePath=".\Format.rc"
				>
			</File>
			<File
				RelativePath=".\Format.tlb"
				SubType="Designer"
				>
			</File>
			<File
				RelativePath="..\Common\VeraCrypt_Volume.ico"
				>
			</File>
			<File
				RelativePath=".\VeraCrypt_wizard.bmp"
				>
			</File>
			<Filter
				Name="Common"
				>
				<File
					RelativePath="..\Boot\Windows\Rescue_AES\BootLoader.com.gz"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Rescue\BootLoader.com.gz"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Rescue_Twofish\BootLoader.com.gz"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Release_Serpent\BootLoader.com.gz"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Release_AES\BootLoader.com.gz"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Release\BootLoader.com.gz"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Release_Twofish\BootLoader.com.gz"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Rescue_Serpent\BootLoader.com.gz"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Rescue_AES\BootSector.bin"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Rescue\BootSector.bin"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Release\BootSector.bin"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Release_Serpent\BootSector.bin"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Rescue_Serpent\BootSector.bin"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Rescue_Twofish\BootSector.bin"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Release_Twofish\BootSector.bin"
					>
				</File>
				<File
					RelativePath="..\Boot\Windows\Release_AES\BootSector.bin"
					>
				</File>
				<File
					RelativePath="..\Common\Common.rc"
					>
					<FileConfiguration
						Name="Debug|Win32"
						ExcludedFromBuild="true"
						>
						<Tool
							Name="VCResourceCompilerTool"
						/>
					</FileConfiguration>
					<FileConfiguration
						Name="Release|Win32"
						ExcludedFromBuild="true"
						>
						<Tool
							Name="VCResourceCompilerTool"
						/>
					</FileConfiguration>
				</File>
				<File
					RelativePath="..\Boot\Windows\Release\Decompressor.com"
					>
				</File>
				<File
					RelativePath="..\Common\Language.xml"
					>
				</File>
				<File
					RelativePath="..\Resources\Texts\License.rtf"
					>
				</File>
				<File
					RelativePath="..\Common\Textual_logo_288dpi.bmp"
					>
				</File>
				<File
					RelativePath="..\Common\Textual_logo_96dpi.bmp"
					>
				</File>
				<File
					RelativePath="..\Common\Textual_logo_background.bmp"
					>
				</File>
				<File
					RelativePath="..\Common\VeraCrypt.ico"
					>
				</File>
			</Filter>
		</Filter>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>