diff options
Diffstat (limited to 'src/Format')
-rw-r--r-- | src/Format/Format.manifest | 8 | ||||
-rw-r--r-- | src/Format/Format.rc | 8 | ||||
-rw-r--r-- | src/Format/Format.vcxproj | 16 | ||||
-rw-r--r-- | src/Format/FormatCom.cpp | 39 | ||||
-rw-r--r-- | src/Format/FormatCom.h | 1 | ||||
-rw-r--r-- | src/Format/FormatCom.idl | 1 | ||||
-rw-r--r-- | src/Format/Format_vs2019.vcxproj | 63 | ||||
-rw-r--r-- | src/Format/InPlace.c | 73 | ||||
-rw-r--r-- | src/Format/Tcformat.c | 80 |
9 files changed, 143 insertions, 146 deletions
diff --git a/src/Format/Format.manifest b/src/Format/Format.manifest index 5d4cb896..79d86799 100644 --- a/src/Format/Format.manifest +++ b/src/Format/Format.manifest @@ -1,33 +1,39 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedPrivileges> <requestedExecutionLevel level="asInvoker" uiAccess="false"/> </requestedPrivileges> </security> </trustInfo> <asmv3:application> <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> <dpiAware>true</dpiAware> </asmv3:windowsSettings> </asmv3:application> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> - <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> + <!-- Windows 10 and Windows 11 --> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> + <!-- Windows 8.1 --> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> + <!-- Windows 8 --> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> + <!-- Windows 7 --> <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> </application> </compatibility> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly>
\ No newline at end of file diff --git a/src/Format/Format.rc b/src/Format/Format.rc index 7d60524e..c988a811 100644 --- a/src/Format/Format.rc +++ b/src/Format/Format.rc @@ -1,83 +1,83 @@ // Microsoft Visual C++ generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "winres.h" #include "..\\common\\resource.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,26,4,0 - PRODUCTVERSION 1,26,4,0 + FILEVERSION 1,26,15,0 + PRODUCTVERSION 1,26,15,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "IDRIX" VALUE "FileDescription", "VeraCrypt Format" - VALUE "FileVersion", "1.26.4" + VALUE "FileVersion", "1.26.15" VALUE "LegalTrademarks", "VeraCrypt" VALUE "OriginalFilename", "VeraCrypt Format.exe" VALUE "ProductName", "VeraCrypt" - VALUE "ProductVersion", "1.26.4" + VALUE "ProductVersion", "1.26.15" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END ///////////////////////////////////////////////////////////////////////////// // // HEADER // IDR_FORMAT_RSRC_HEADER HEADER "resource.h" ///////////////////////////////////////////////////////////////////////////// // // TYPELIB // IDR_FORMAT_TLB TYPELIB "Format.tlb" ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_VOL_CREATION_WIZARD_DLG DIALOGEX 0, 0, 450, 250 STYLE DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU diff --git a/src/Format/Format.vcxproj b/src/Format/Format.vcxproj index 06e3dca7..1ae26d43 100644 --- a/src/Format/Format.vcxproj +++ b/src/Format/Format.vcxproj @@ -154,356 +154,356 @@ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='Release_SkipOsDriverReqCheck|Win32'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='Release_SkipOsDriverReqCheck|x64'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">VeraCryptFormat</TargetName> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <Midl> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\Debug\crypto.lib;..\Common\Debug\Zip.lib;..\Common\Debug\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>$(OutDir)Format.pdb</ProgramDatabaseFile> <SubSystem>Windows</SubSystem> <RandomizedBaseAddress>false</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX86</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>md "..\Debug\Setup Files" 2>NUL: copy Debug\VeraCryptFormat.exe "..\Debug\Setup Files\VeraCrypt Format.exe" >NUL: </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <Midl> <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\x64\Debug\crypto.lib;..\Common\x64\Debug\Zip.lib;..\Common\x64\Debug\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>$(OutDir)Format.pdb</ProgramDatabaseFile> <SubSystem>Windows</SubSystem> <RandomizedBaseAddress>false</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX64</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>md "..\Debug\Setup Files" 2>NUL: copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: </Command> </PostBuildEvent> <ResourceCompile> <PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <Midl> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX86</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>copy Release\VeraCryptFormat.exe "..\Release\Setup Files\VeraCrypt Format.exe"</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_SkipOsDriverReqCheck|Win32'"> <Midl> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;VC_SKIP_OS_DRIVER_REQ_CHECK;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX86</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>copy Release\VeraCryptFormat.exe "..\Release\Setup Files\VeraCrypt Format.exe"</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'"> <Midl> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX86</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>copy Release\VeraCryptFormat.exe "..\Release\Setup Files\VeraCrypt Format.exe"</Command> </PostBuildEvent> <ResourceCompile> <PreprocessorDefinitions>VC_EFI_CUSTOM_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <Midl> <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX64</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>copy $(TargetPath) "..\Release\Setup Files\VeraCrypt Format-x64.exe"</Command> </PostBuildEvent> <ResourceCompile> <PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_SkipOsDriverReqCheck|x64'"> <Midl> <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;VC_SKIP_OS_DRIVER_REQ_CHECK;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX64</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>copy $(TargetPath) "..\Release\Setup Files\VeraCrypt Format-x64.exe"</Command> </PostBuildEvent> <ResourceCompile> <PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'"> <Midl> <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX64</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>copy $(TargetPath) "..\Release\Setup Files\VeraCrypt Format-x64.exe"</Command> </PostBuildEvent> <ResourceCompile> <PreprocessorDefinitions>VC_EFI_CUSTOM_MODE;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="..\Common\CommandAPDU.cpp" /> <ClCompile Include="..\Common\EMVCard.cpp" /> <ClCompile Include="..\Common\EMVToken.cpp" /> <ClCompile Include="..\Common\PCSCException.cpp" /> <ClCompile Include="..\Common\ResponseAPDU.cpp" /> <ClCompile Include="..\Common\SCard.cpp" /> <ClCompile Include="..\Common\SCardLoader.cpp" /> <ClCompile Include="..\Common\SCardManager.cpp" /> <ClCompile Include="..\Common\SCardReader.cpp" /> <ClCompile Include="..\Common\TLVParser.cpp" /> diff --git a/src/Format/FormatCom.cpp b/src/Format/FormatCom.cpp index 18653761..90333f23 100644 --- a/src/Format/FormatCom.cpp +++ b/src/Format/FormatCom.cpp @@ -160,60 +160,65 @@ public: virtual DWORD STDMETHODCALLTYPE RestoreEfiSystemLoader () { return BaseCom::RestoreEfiSystemLoader (); } virtual DWORD STDMETHODCALLTYPE GetEfiBootDeviceNumber (BSTR* pSdn) { return BaseCom::GetEfiBootDeviceNumber (pSdn); } virtual DWORD STDMETHODCALLTYPE GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded) { return BaseCom::GetSecureBootConfig (pSecureBootEnabled, pVeraCryptKeysLoaded); } virtual DWORD STDMETHODCALLTYPE WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg) { return BaseCom::WriteEfiBootSectorUserConfig (userConfig, customUserMessage,pim, hashAlg); } virtual DWORD STDMETHODCALLTYPE UpdateSetupConfigFile (BOOL bForInstall) { return BaseCom::UpdateSetupConfigFile (bForInstall); } virtual DWORD STDMETHODCALLTYPE NotifyService (DWORD dwNotifyCode) { return BaseCom::NotifyService (dwNotifyCode); } + virtual DWORD STDMETHODCALLTYPE FastFileResize (BSTR filePath, __int64 fileSize) + { + return BaseCom::FastFileResize (filePath, fileSize); + } + protected: DWORD MessageThreadId; LONG RefCount; ITrueCryptFormatCom *CallBack; }; extern "C" BOOL ComServerFormat () { SetProcessShutdownParameters (0x100, 0); TrueCryptFactory<TrueCryptFormatCom> factory (GetCurrentThreadId ()); DWORD cookie; if (IsUacSupported ()) UacElevated = TRUE; if (CoRegisterClassObject (CLSID_TrueCryptFormatCom, (LPUNKNOWN) &factory, CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie) != S_OK) return FALSE; MSG msg; while (int r = GetMessageW (&msg, NULL, 0, 0)) { if (r == -1) return FALSE; TranslateMessage (&msg); DispatchMessageW (&msg); @@ -223,115 +228,141 @@ extern "C" BOOL ComServerFormat () break; } CoRevokeClassObject (cookie); return TRUE; } static BOOL ComGetInstance (HWND hWnd, ITrueCryptFormatCom **tcServer) { return ComGetInstanceBase (hWnd, CLSID_TrueCryptFormatCom, IID_ITrueCryptFormatCom, (void **) tcServer); } ITrueCryptFormatCom *GetElevatedInstance (HWND parent) { ITrueCryptFormatCom *instance; if (!ComGetInstance (parent, &instance)) throw UserAbort (SRC_POS); return instance; } extern "C" int UacFormatNtfs (HWND hWnd, int driveNo, int clusterSize) { CComPtr<ITrueCryptFormatCom> tc; int r; - CoInitialize (NULL); + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); if (ComGetInstance (hWnd, &tc)) r = tc->FormatNtfs (driveNo, clusterSize); else r = (int) GetLastError(); CoUninitialize (); return r; } extern "C" int UacFormatFs (HWND hWnd, int driveNo, int clusterSize, int fsType) { CComPtr<ITrueCryptFormatCom> tc; int r; - CoInitialize (NULL); + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); if (ComGetInstance (hWnd, &tc)) r = tc->FormatFs (driveNo, clusterSize, fsType); else r = (int) GetLastError(); CoUninitialize (); return r; } extern "C" int UacAnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *nbrFreeClusters) { CComPtr<ITrueCryptFormatCom> tc; int r; - CoInitialize (NULL); + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); if (ComGetInstance (hwndDlg, &tc)) r = tc->AnalyzeHiddenVolumeHost ((__int64) hwndDlg, driveNo, hiddenVolHostSize, realClusterSize, nbrFreeClusters); else r = 0; CoUninitialize (); return r; } extern "C" BOOL UacWriteLocalMachineRegistryDword (HWND hwndDlg, wchar_t *keyPath, wchar_t *valueName, DWORD value) { CComPtr<ITrueCryptFormatCom> tc; int r = 0; - CoInitialize (NULL); + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); if (ComGetInstance (hwndDlg, &tc)) { CComBSTR keyPathBstr, valueNameBstr; BSTR bstr = W2BSTR(keyPath); if (bstr) { keyPathBstr.Attach (bstr); bstr = W2BSTR(valueName); if (bstr) { valueNameBstr.Attach (bstr); r = tc->WriteLocalMachineRegistryDwordValue (keyPathBstr, valueNameBstr, value); } else r = ERROR_OUTOFMEMORY; } else r = ERROR_OUTOFMEMORY; } CoUninitialize (); if (r == ERROR_SUCCESS) return TRUE; else { SetLastError (r); return FALSE; } } +extern "C" DWORD UacFastFileCreation (HWND hWnd, wchar_t* filePath, __int64 fileSize) +{ + CComPtr<ITrueCryptFormatCom> tc; + DWORD r; + + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); + + if (ComGetInstance (hWnd, &tc)) + { + CComBSTR filePathBstr; + BSTR bstr = W2BSTR(filePath); + if (bstr) + { + filePathBstr.Attach (bstr); + r = tc->FastFileResize (filePathBstr, fileSize); + } + else + r = ERROR_OUTOFMEMORY; + } + else + r = GetLastError(); + + CoUninitialize (); + + return r; +} diff --git a/src/Format/FormatCom.h b/src/Format/FormatCom.h index 5ab6bd52..e474608d 100644 --- a/src/Format/FormatCom.h +++ b/src/Format/FormatCom.h @@ -3,36 +3,37 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0. Modifications and additions to the original source code (contained in this file) and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ #ifndef TC_HEADER_FORMAT_COM #define TC_HEADER_FORMAT_COM #include <windows.h> #ifdef __cplusplus #include "FormatCom_h.h" ITrueCryptFormatCom *GetElevatedInstance (HWND parent); extern "C" { #endif BOOL ComServerFormat (); int UacFormatNtfs (HWND hWnd, int driveNo, int clusterSize); int UacFormatFs (HWND hWnd, int driveNo, int clusterSize, int fsType); int UacAnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *nbrFreeClusters); int UacFormatVolume (char *cvolumePath , BOOL bDevice , unsigned __int64 size , unsigned __int64 hiddenVolHostSize , Password *password , int cipher , int pkcs5 , BOOL quickFormat, BOOL sparseFileSwitch, int fileSystem , int clusterSize, HWND hwndDlg , BOOL hiddenVol , int *realClusterSize); BOOL UacUpdateProgressBar (__int64 nSecNo, BOOL *bVolTransformThreadCancel); BOOL UacWriteLocalMachineRegistryDword (HWND hwndDlg, wchar_t *keyPath, wchar_t *valueName, DWORD value); +DWORD UacFastFileCreation (HWND hWnd, wchar_t* filePath, __int64 fileSize); #ifdef __cplusplus } #endif #endif // TC_HEADER_FORMAT_COM
\ No newline at end of file diff --git a/src/Format/FormatCom.idl b/src/Format/FormatCom.idl index cae4e155..7276de81 100644 --- a/src/Format/FormatCom.idl +++ b/src/Format/FormatCom.idl @@ -23,41 +23,42 @@ library TrueCryptFormatCom [ uuid(7AB357D9-A17F-466e-BCD6-F49E97C218D8), object, oleautomation, helpstring("VeraCrypt Format UAC Support Interface") ] interface ITrueCryptFormatCom : IUnknown { int AnalyzeHiddenVolumeHost (__int64 hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *nbrFreeClusters); DWORD CallDriver (DWORD ioctl, BSTR input, BSTR *output); DWORD CopyFile (BSTR sourceFile, BSTR destinationFile); DWORD DeleteFile (BSTR file); BOOL FormatNtfs (int driveNo, int clusterSize); BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly); DWORD ReadWriteFile (BOOL write, BOOL device, BSTR filePath, BSTR *bufferBstr, unsigned __int64 offset, unsigned __int32 size, DWORD *sizeDone); DWORD RegisterFilterDriver (BOOL registerDriver, int filterType); DWORD RegisterSystemFavoritesService (BOOL registerService); DWORD SetDriverServiceStartType (DWORD startType); DWORD WriteLocalMachineRegistryDwordValue (BSTR keyPath, BSTR valueName, DWORD value); BOOL FormatFs (int driveNo, int clusterSize, int fsType); DWORD GetFileSize (BSTR filePath, unsigned __int64* pSize); DWORD DeviceIoControl (BOOL readOnly, BOOL device, BSTR filePath, DWORD dwIoControlCode, BSTR input, BSTR *output); DWORD InstallEfiBootLoader (BOOL preserveUserConfig, BOOL hiddenOSCreation, int pim, int hashAlg); DWORD BackupEfiSystemLoader (); DWORD RestoreEfiSystemLoader (); DWORD GetEfiBootDeviceNumber (BSTR* pSdn); DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg); DWORD UpdateSetupConfigFile (BOOL bForInstall); DWORD GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded); DWORD NotifyService (DWORD dwNotifyCode); + DWORD FastFileResize (BSTR filePath, __int64 fileSize); }; [ uuid(A96D3797-9F31-49f4-A0CE-9657392CF789), helpstring("VeraCrypt Format UAC Support Coclass") ] coclass TrueCryptFormatCom { [default] interface ITrueCryptFormatCom; } } diff --git a/src/Format/Format_vs2019.vcxproj b/src/Format/Format_vs2019.vcxproj index 819724f2..dc8de14a 100644 --- a/src/Format/Format_vs2019.vcxproj +++ b/src/Format/Format_vs2019.vcxproj @@ -23,80 +23,83 @@ </ProjectConfiguration> <ProjectConfiguration Include="ReleaseCustomEFI|x64"> <Configuration>ReleaseCustomEFI</Configuration> <Platform>x64</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|ARM64"> <Configuration>Release</Configuration> <Platform>ARM64</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|x64"> <Configuration>Release</Configuration> <Platform>x64</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{9DC1ABE2-D18B-48FB-81D2-8C50ADC57BCF}</ProjectGuid> <RootNamespace>Format</RootNamespace> <Keyword>Win32Proj</Keyword> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <ProjectName>Format</ProjectName> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <PlatformToolset>v142</PlatformToolset> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <PlatformToolset>v142</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <PlatformToolset>v142</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <PlatformToolset>v142</PlatformToolset> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <PlatformToolset>v142</PlatformToolset> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <PlatformToolset>v142</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <PlatformToolset>v142</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <PlatformToolset>v142</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <PlatformToolset>v142</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> @@ -106,465 +109,471 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup> <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</GenerateManifest> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(Platform)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Platform)\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(ProjectDir)$(Platform)\$(Configuration)\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</LinkIncremental> <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</GenerateManifest> <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</GenerateManifest> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</OutDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'">Release\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'">Release\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'">$(ProjectDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'">$(ProjectDir)$(Configuration)\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'">false</LinkIncremental> <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest> <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'">true</GenerateManifest> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(Platform)\$(Configuration)\</OutDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">$(Platform)\$(Configuration)\</OutDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(Platform)\$(Configuration)\</IntDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">$(Platform)\$(Configuration)\</IntDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">$(Platform)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Platform)\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(ProjectDir)$(Platform)\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">$(ProjectDir)$(Platform)\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">$(ProjectDir)$(Platform)\$(Configuration)\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">false</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">false</LinkIncremental> <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateManifest> <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</GenerateManifest> <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">true</GenerateManifest> <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">true</GenerateManifest> <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'">VeraCryptFormat</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'">VeraCryptFormat</TargetName> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <Midl> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\Debug\crypto.lib;..\Common\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>$(OutDir)Format.pdb</ProgramDatabaseFile> <SubSystem>Windows</SubSystem> <RandomizedBaseAddress>false</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX86</TargetMachine> + <GenerateMapFile>true</GenerateMapFile> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>md "..\Debug\Setup Files" 2>NUL: copy Debug\VeraCryptFormat.exe "..\Debug\Setup Files\VeraCrypt Format.exe" >NUL: </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <Midl> <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\ARM64\Debug\crypto.lib;..\Common\ARM64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>$(OutDir)Format.pdb</ProgramDatabaseFile> <SubSystem>Windows</SubSystem> <RandomizedBaseAddress>false</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX64</TargetMachine> + <GenerateMapFile>true</GenerateMapFile> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>md "..\Debug\Setup Files" 2>NUL: copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: </Command> </PostBuildEvent> <ResourceCompile> <PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> <Midl> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\ARM64\Debug\crypto.lib;..\Common\ARM64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>$(OutDir)Format.pdb</ProgramDatabaseFile> <SubSystem>Windows</SubSystem> <DataExecutionPrevention>true</DataExecutionPrevention> + <GenerateMapFile>true</GenerateMapFile> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>md "..\Debug\Setup Files" 2>NUL: copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" >NUL: </Command> </PostBuildEvent> <ResourceCompile> <PreprocessorDefinitions>WIN64;ARM64;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <Midl> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <ControlFlowGuard>Guard</ControlFlowGuard> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX86</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>copy Release\VeraCryptFormat.exe "..\Release\Setup Files\VeraCrypt Format.exe"</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|Win32'"> <Midl> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX86</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>copy Release\VeraCryptFormat.exe "..\Release\Setup Files\VeraCrypt Format.exe"</Command> </PostBuildEvent> <ResourceCompile> <PreprocessorDefinitions>VC_EFI_CUSTOM_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <Midl> <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <ControlFlowGuard>Guard</ControlFlowGuard> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX64</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>copy $(TargetPath) "..\Release\Setup Files\VeraCrypt Format-x64.exe"</Command> </PostBuildEvent> <ResourceCompile> <PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> <Midl> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <ControlFlowGuard>Guard</ControlFlowGuard> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\ARM64\Release\crypto.lib;..\Common\ARM64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>copy $(TargetPath) "..\Release\Setup Files\VeraCrypt Format-arm64.exe"</Command> </PostBuildEvent> <ResourceCompile> <PreprocessorDefinitions>WIN64;ARM64;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|x64'"> <Midl> <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> <TargetMachine>MachineX64</TargetMachine> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>copy $(TargetPath) "..\Release\Setup Files\VeraCrypt Format-x64.exe"</Command> </PostBuildEvent> <ResourceCompile> <PreprocessorDefinitions>VC_EFI_CUSTOM_MODE;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCustomEFI|ARM64'"> <Midl> <TypeLibraryName>$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb</TypeLibraryName> </Midl> <ClCompile> <AdditionalOptions>/w34189 %(AdditionalOptions)</AdditionalOptions> <Optimization>MaxSpeed</Optimization> <AdditionalIncludeDirectories>..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;..\Common\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>VOLFORMAT;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <PrecompiledHeader> </PrecompiledHeader> <AssemblerOutput>All</AssemblerOutput> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <DelayLoadDLLs>mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <GenerateMapFile>true</GenerateMapFile> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <RandomizedBaseAddress>true</RandomizedBaseAddress> <DataExecutionPrevention>true</DataExecutionPrevention> </Link> <Manifest> <AdditionalManifestFiles>Format.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> <PostBuildEvent> <Command>copy $(TargetPath) "..\Release\Setup Files\VeraCrypt Format-arm64.exe"</Command> </PostBuildEvent> <ResourceCompile> <PreprocessorDefinitions>VC_EFI_CUSTOM_MODE;WIN64;ARM64;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="..\Common\CommandAPDU.cpp" /> <ClCompile Include="..\Common\EMVCard.cpp" /> <ClCompile Include="..\Common\EMVToken.cpp" /> <ClCompile Include="..\Common\PCSCException.cpp" /> <ClCompile Include="..\Common\ResponseAPDU.cpp" /> <ClCompile Include="..\Common\SCard.cpp" /> <ClCompile Include="..\Common\SCardLoader.cpp" /> <ClCompile Include="..\Common\SCardManager.cpp" /> <ClCompile Include="..\Common\SCardReader.cpp" /> <ClCompile Include="..\Common\TLVParser.cpp" /> <ClCompile Include="..\Common\Token.cpp" /> diff --git a/src/Format/InPlace.c b/src/Format/InPlace.c index 877ff7eb..361b8aeb 100644 --- a/src/Format/InPlace.c +++ b/src/Format/InPlace.c @@ -573,107 +573,107 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol nStatus = CreateVolumeHeaderInMemory (hwndDlg, FALSE, header, volParams->ea, FIRST_MODE_OF_OPERATION_ID, volParams->password, volParams->pkcs5, volParams->pim, wipePass == 0 ? NULL : (char *) cryptoInfo->master_keydata, &cryptoInfo, dataAreaSize, 0, TC_VOLUME_DATA_OFFSET + dataAreaSize, // Start of the encrypted area = the first byte of the backup heeader (encrypting from the end) 0, // No data is encrypted yet 0, volParams->headerFlags | TC_HEADER_FLAG_NONSYS_INPLACE_ENC, volParams->sectorSize, wipeAlgorithm == TC_WIPE_NONE ? FALSE : (wipePass < PRAND_HEADER_WIPE_PASSES - 1)); if (nStatus != 0) goto closing_seq; offset.QuadPart = TC_VOLUME_DATA_OFFSET + dataAreaSize; if (!MoveFilePointer (dev, offset)) { nStatus = ERR_OS_ERROR; goto closing_seq; } // Write the backup header to the partition - if (!WriteEffectiveVolumeHeader (TRUE, dev, (byte *) header)) + if (!WriteEffectiveVolumeHeader (TRUE, dev, (uint8 *) header)) { nStatus = ERR_OS_ERROR; goto closing_seq; } // Fill the reserved sectors of the backup header area with random data nStatus = WriteRandomDataToReservedHeaderAreas (hwndDlg, dev, cryptoInfo, dataAreaSize, FALSE, TRUE); if (nStatus != ERR_SUCCESS) goto closing_seq; // write fake hidden volume header to protect against attacks that use statistical entropy // analysis to detect presence of hidden volumes nStatus = CreateVolumeHeaderInMemory (hwndDlg, FALSE, header, volParams->ea, FIRST_MODE_OF_OPERATION_ID, NULL, 0, 0, NULL, &dummyInfo, dataAreaSize, dataAreaSize, TC_VOLUME_DATA_OFFSET + dataAreaSize, // Start of the encrypted area = the first byte of the backup heeader (encrypting from the end) dataAreaSize, // No data is encrypted yet 0, volParams->headerFlags | TC_HEADER_FLAG_NONSYS_INPLACE_ENC, volParams->sectorSize, wipeAlgorithm == TC_WIPE_NONE ? FALSE : (wipePass < PRAND_HEADER_WIPE_PASSES - 1)); if (nStatus != ERR_SUCCESS) goto closing_seq; crypto_close (dummyInfo); offset.QuadPart += TC_HIDDEN_VOLUME_HEADER_OFFSET; if (!MoveFilePointer (dev, offset)) { nStatus = ERR_OS_ERROR; goto closing_seq; } // Write the fake hidden backup header to the partition - if (!WriteEffectiveVolumeHeader (TRUE, dev, (byte *) header)) + if (!WriteEffectiveVolumeHeader (TRUE, dev, (uint8 *) header)) { nStatus = ERR_OS_ERROR; goto closing_seq; } } /* Now we will try to decrypt the backup header to verify it has been correctly written. */ nStatus = OpenBackupHeader (dev, volParams->volumePath, volParams->password, volParams->pkcs5, volParams->pim, &cryptoInfo2, NULL, deviceSize); if (nStatus != ERR_SUCCESS || cryptoInfo->EncryptedAreaStart.Value != cryptoInfo2->EncryptedAreaStart.Value || cryptoInfo2->EncryptedAreaStart.Value == 0) { if (nStatus == ERR_SUCCESS) nStatus = ERR_PARAMETER_INCORRECT; goto closing_seq; } // The backup header is valid so we know we should be able to safely resume in-place encryption // of this partition even if the system/app crashes. /* Conceal the NTFS filesystem (by performing an easy-to-undo modification). This will prevent Windows and apps from interfering with the volume until it has been fully encrypted. */ @@ -727,108 +727,108 @@ closing_seq: if (cryptoInfo2 != NULL) { crypto_close (cryptoInfo2); cryptoInfo2 = NULL; } burn (header, TC_VOLUME_HEADER_EFFECTIVE_SIZE); VirtualUnlock (header, TC_VOLUME_HEADER_EFFECTIVE_SIZE); TCfree (header); if (dosDev[0]) RemoveFakeDosName (volParams->volumePath, dosDev); *outHandle = dev; if (nStatus != ERR_SUCCESS) SetLastError (dwError); return nStatus; } int EncryptPartitionInPlaceResume (HANDLE dev, volatile FORMAT_VOL_PARAMETERS *volParams, WipeAlgorithmId wipeAlgorithm, volatile BOOL *bTryToCorrectReadErrors) { PCRYPTO_INFO masterCryptoInfo = NULL, headerCryptoInfo = NULL, tmpCryptoInfo = NULL; UINT64_STRUCT unitNo; char *buf = NULL, *header = NULL; - byte *wipeBuffer = NULL; - byte wipeRandChars [TC_WIPE_RAND_CHAR_COUNT]; - byte wipeRandCharsUpdate [TC_WIPE_RAND_CHAR_COUNT]; + uint8 *wipeBuffer = NULL; + uint8 wipeRandChars [TC_WIPE_RAND_CHAR_COUNT]; + uint8 wipeRandCharsUpdate [TC_WIPE_RAND_CHAR_COUNT]; WCHAR dosDev[TC_MAX_PATH] = {0}; WCHAR devName[MAX_PATH] = {0}; WCHAR deviceName[MAX_PATH]; int nStatus = ERR_SUCCESS; __int64 deviceSize; uint64 remainingBytes, lastHeaderUpdateDistance = 0, zeroedSectorCount = 0; uint32 workChunkSize; DWORD dwError, dwResult; BOOL bPause = FALSE, bEncryptedAreaSizeChanged = FALSE; LARGE_INTEGER offset; int sectorSize; int i; DWORD n; WCHAR *devicePath = volParams->volumePath; Password *password = volParams->password; int pkcs5_prf = volParams->pkcs5; int pim = volParams->pim; DISK_GEOMETRY driveGeometry; HWND hwndDlg = volParams->hwndDlg; #ifdef _WIN64 BOOL bIsRamEncryptionEnabled = IsRamEncryptionEnabled(); #endif bInPlaceEncNonSysResumed = TRUE; buf = (char *) TCalloc (TC_MAX_NONSYS_INPLACE_ENC_WORK_CHUNK_SIZE); if (!buf) { nStatus = ERR_OUTOFMEMORY; goto closing_seq; } header = (char *) TCalloc (TC_VOLUME_HEADER_EFFECTIVE_SIZE); if (!header) { nStatus = ERR_OUTOFMEMORY; goto closing_seq; } VirtualLock (header, TC_VOLUME_HEADER_EFFECTIVE_SIZE); if (wipeAlgorithm != TC_WIPE_NONE) { - wipeBuffer = (byte *) TCalloc (TC_MAX_NONSYS_INPLACE_ENC_WORK_CHUNK_SIZE); + wipeBuffer = (uint8 *) TCalloc (TC_MAX_NONSYS_INPLACE_ENC_WORK_CHUNK_SIZE); if (!wipeBuffer) { nStatus = ERR_OUTOFMEMORY; goto closing_seq; } } headerCryptoInfo = crypto_open(); if (headerCryptoInfo == NULL) { nStatus = ERR_OUTOFMEMORY; goto closing_seq; } deviceSize = GetDeviceSize (devicePath); if (deviceSize < 0) { // Cannot determine the size of the partition nStatus = ERR_OS_ERROR; goto closing_seq; } if (dev == INVALID_HANDLE_VALUE) { StringCchCopyW (deviceName, ARRAYSIZE(deviceName), devicePath); if (FakeDosNameForDevice (deviceName, dosDev, sizeof(dosDev),devName, sizeof(devName),FALSE) != 0) { nStatus = ERR_OS_ERROR; @@ -947,135 +947,135 @@ inplace_enc_read: if (nStatus != ERR_SUCCESS) { // Due to write errors, we can't correct the read errors nStatus = ERR_OS_ERROR; goto closing_seq; } goto inplace_enc_read; } } SetLastError (dwTmpErr); // Preserve the original error code nStatus = ERR_OS_ERROR; goto closing_seq; } if (remainingBytes - workChunkSize < TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE) { // We reached the inital portion of the filesystem, which we had concealed (in order to prevent // Windows from interfering with the volume). Now we need to undo that modification. for (i = 0; i < TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE - (remainingBytes - workChunkSize); i++) buf[i] ^= TC_NTFS_CONCEAL_CONSTANT; } // Encrypt the plaintext in RAM - EncryptDataUnits ((byte *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo); + EncryptDataUnits ((uint8 *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo); // If enabled, wipe the area to which we will write the ciphertext if (wipeAlgorithm != TC_WIPE_NONE) { - byte wipePass; + uint8 wipePass; int wipePassCount = GetWipePassCount (wipeAlgorithm); if (wipePassCount <= 0) { SetLastError (ERROR_INVALID_PARAMETER); nStatus = ERR_PARAMETER_INCORRECT; goto closing_seq; } offset.QuadPart = masterCryptoInfo->EncryptedAreaStart.Value - workChunkSize; for (wipePass = 1; wipePass <= wipePassCount; ++wipePass) { if (!WipeBuffer (wipeAlgorithm, wipeRandChars, wipePass, wipeBuffer, workChunkSize)) { ULONG i; for (i = 0; i < workChunkSize; ++i) { wipeBuffer[i] = buf[i] + wipePass; } EncryptDataUnits (wipeBuffer, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo); memcpy (wipeRandCharsUpdate, wipeBuffer, sizeof (wipeRandCharsUpdate)); } if (MoveFilePointer (dev, offset) == 0 || WriteFile (dev, wipeBuffer, workChunkSize, &n, NULL) == 0) { // Write error dwError = GetLastError(); // Undo failed write operation if (workChunkSize > TC_VOLUME_DATA_OFFSET && MoveFilePointer (dev, offset)) { - DecryptDataUnits ((byte *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo); + DecryptDataUnits ((uint8 *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo); WriteFile (dev, buf + TC_VOLUME_DATA_OFFSET, workChunkSize - TC_VOLUME_DATA_OFFSET, &n, NULL); } SetLastError (dwError); nStatus = ERR_OS_ERROR; goto closing_seq; } } memcpy (wipeRandChars, wipeRandCharsUpdate, sizeof (wipeRandCharsUpdate)); } // Write the ciphertext offset.QuadPart = masterCryptoInfo->EncryptedAreaStart.Value - workChunkSize; if (MoveFilePointer (dev, offset) == 0) { nStatus = ERR_OS_ERROR; goto closing_seq; } if (WriteFile (dev, buf, workChunkSize, &n, NULL) == 0) { // Write error dwError = GetLastError(); // Undo failed write operation if (workChunkSize > TC_VOLUME_DATA_OFFSET && MoveFilePointer (dev, offset)) { - DecryptDataUnits ((byte *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo); + DecryptDataUnits ((uint8 *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo); WriteFile (dev, buf + TC_VOLUME_DATA_OFFSET, workChunkSize - TC_VOLUME_DATA_OFFSET, &n, NULL); } SetLastError (dwError); nStatus = ERR_OS_ERROR; goto closing_seq; } masterCryptoInfo->EncryptedAreaStart.Value -= workChunkSize; masterCryptoInfo->EncryptedAreaLength.Value += workChunkSize; remainingBytes -= workChunkSize; lastHeaderUpdateDistance += workChunkSize; bEncryptedAreaSizeChanged = TRUE; if (lastHeaderUpdateDistance >= TC_NONSYS_INPLACE_ENC_HEADER_UPDATE_INTERVAL) { nStatus = FastVolumeHeaderUpdate (dev, headerCryptoInfo, masterCryptoInfo, deviceSize); if (nStatus != ERR_SUCCESS) goto closing_seq; lastHeaderUpdateDistance = 0; } ExportProgressStats (masterCryptoInfo->EncryptedAreaLength.Value, masterCryptoInfo->VolumeSize.Value); if (bVolTransformThreadCancel) @@ -1122,120 +1122,120 @@ inplace_enc_read: password, masterCryptoInfo->pkcs5, pim, (char *) masterCryptoInfo->master_keydata, &tmpCryptoInfo, masterCryptoInfo->VolumeSize.Value, 0, masterCryptoInfo->EncryptedAreaStart.Value, masterCryptoInfo->EncryptedAreaLength.Value, masterCryptoInfo->RequiredProgramVersion, masterCryptoInfo->HeaderFlags | TC_HEADER_FLAG_NONSYS_INPLACE_ENC, masterCryptoInfo->SectorSize, wipeAlgorithm == TC_WIPE_NONE ? FALSE : (wipePass < PRAND_HEADER_WIPE_PASSES - 1)); #ifdef _WIN64 if (bIsRamEncryptionEnabled) { masterCryptoInfo = cryptoInfoBackup; burn (&tmpCI, sizeof (CRYPTO_INFO)); VirtualUnlock (&tmpCI, sizeof(tmpCI)); } #endif if (nStatus != ERR_SUCCESS) goto closing_seq; offset.QuadPart = TC_VOLUME_HEADER_OFFSET; if (MoveFilePointer (dev, offset) == 0 - || !WriteEffectiveVolumeHeader (TRUE, dev, (byte *) header)) + || !WriteEffectiveVolumeHeader (TRUE, dev, (uint8 *) header)) { nStatus = ERR_OS_ERROR; goto closing_seq; } #ifdef _WIN64 if (bIsRamEncryptionEnabled) { VirtualLock (&tmpCI, sizeof(tmpCI)); memcpy (&tmpCI, headerCryptoInfo, sizeof (CRYPTO_INFO)); VcUnprotectKeys (&tmpCI, VcGetEncryptionID (headerCryptoInfo)); cryptoInfoBackup = headerCryptoInfo; headerCryptoInfo = &tmpCI; } #endif // Fill the reserved sectors of the header area with random data nStatus = WriteRandomDataToReservedHeaderAreas (hwndDlg, dev, headerCryptoInfo, masterCryptoInfo->VolumeSize.Value, TRUE, FALSE); #ifdef _WIN64 if (bIsRamEncryptionEnabled) { headerCryptoInfo = cryptoInfoBackup; burn (&tmpCI, sizeof (CRYPTO_INFO)); VirtualUnlock (&tmpCI, sizeof(tmpCI)); } #endif if (nStatus != ERR_SUCCESS) goto closing_seq; // write fake hidden volume header to protect against attacks that use statistical entropy // analysis to detect presence of hidden volumes nStatus = CreateVolumeHeaderInMemory (hwndDlg, FALSE, header, headerCryptoInfo->ea, headerCryptoInfo->mode, NULL, 0, 0, NULL, &dummyInfo, masterCryptoInfo->VolumeSize.Value, masterCryptoInfo->VolumeSize.Value, masterCryptoInfo->EncryptedAreaStart.Value, masterCryptoInfo->EncryptedAreaLength.Value, masterCryptoInfo->RequiredProgramVersion, masterCryptoInfo->HeaderFlags | TC_HEADER_FLAG_NONSYS_INPLACE_ENC, masterCryptoInfo->SectorSize, wipeAlgorithm == TC_WIPE_NONE ? FALSE : (wipePass < PRAND_HEADER_WIPE_PASSES - 1)); if (nStatus != ERR_SUCCESS) goto closing_seq; crypto_close (dummyInfo); offset.QuadPart += TC_HIDDEN_VOLUME_HEADER_OFFSET; if (MoveFilePointer (dev, offset) == 0 - || !WriteEffectiveVolumeHeader (TRUE, dev, (byte *) header)) + || !WriteEffectiveVolumeHeader (TRUE, dev, (uint8 *) header)) { nStatus = ERR_OS_ERROR; goto closing_seq; } } // Update the configuration files SaveNonSysInPlaceEncSettings (-1, wipeAlgorithm, FALSE); SetNonSysInplaceEncUIStatus (NONSYS_INPLACE_ENC_STATUS_FINISHED); nStatus = ERR_SUCCESS; } else { // The process has been paused by the user or aborted by the wizard (e.g. on app exit) nStatus = ERR_USER_ABORT; SetNonSysInplaceEncUIStatus (NONSYS_INPLACE_ENC_STATUS_PAUSED); } closing_seq: dwError = GetLastError(); @@ -1289,61 +1289,61 @@ closing_seq: if (wipeBuffer != NULL) TCfree (wipeBuffer); if (zeroedSectorCount > 0) { wchar_t msg[30000] = {0}; wchar_t sizeStr[500] = {0}; GetSizeString (zeroedSectorCount * sectorSize, sizeStr, sizeof(sizeStr)); StringCbPrintfW (msg, sizeof(msg), GetString ("ZEROED_BAD_SECTOR_COUNT"), zeroedSectorCount, sizeStr); WarningDirect (msg, hwndDlg); } if (nStatus != ERR_SUCCESS && nStatus != ERR_USER_ABORT) SetLastError (dwError); return nStatus; } int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile BOOL *DiscardUnreadableEncryptedSectors) { HANDLE dev = INVALID_HANDLE_VALUE; PCRYPTO_INFO masterCryptoInfo = NULL, headerCryptoInfo = NULL; UINT64_STRUCT unitNo; char *buf = NULL; - byte *tmpSectorBuf = NULL; + uint8 *tmpSectorBuf = NULL; WCHAR dosDev[TC_MAX_PATH] = {0}; WCHAR devName[MAX_PATH] = {0}; WCHAR deviceName[MAX_PATH]; int nStatus = ERR_SUCCESS; __int64 deviceSize; uint64 remainingBytes, workChunkStartByteOffset, lastHeaderUpdateDistance = 0, skippedBadSectorCount = 0; uint32 workChunkSize; DWORD dwError, dwResult; BOOL bPause = FALSE, bEncryptedAreaSizeChanged = FALSE; LARGE_INTEGER offset; int sectorSize; int i; DWORD n; WCHAR *devicePath = volParams->volumePath; Password *password = volParams->password; HWND hwndDlg = volParams->hwndDlg; int pkcs5_prf = volParams->pkcs5; int pim = volParams->pim; DISK_GEOMETRY driveGeometry; #ifdef _WIN64 BOOL bIsRamEncryptionEnabled = IsRamEncryptionEnabled(); #endif buf = (char *) TCalloc (TC_MAX_NONSYS_INPLACE_ENC_WORK_CHUNK_SIZE); if (!buf) { nStatus = ERR_OUTOFMEMORY; goto closing_seq; } @@ -1405,61 +1405,61 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile // This should never be needed, but is still performed for extra safety (without checking the result) DeviceIoControl (dev, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, 0, NULL, 0, &dwResult, NULL); if (!DeviceIoControl (dev, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &driveGeometry, sizeof (driveGeometry), &dwResult, NULL)) { nStatus = ERR_OS_ERROR; goto closing_seq; } if ( (driveGeometry.BytesPerSector == 0) || (driveGeometry.BytesPerSector > TC_MAX_VOLUME_SECTOR_SIZE) || (driveGeometry.BytesPerSector % ENCRYPTION_DATA_UNIT_SIZE != 0) ) { Error ("SECTOR_SIZE_UNSUPPORTED", hwndDlg); nStatus = ERR_DONT_REPORT; goto closing_seq; } sectorSize = driveGeometry.BytesPerSector; - tmpSectorBuf = (byte *) TCalloc (sectorSize); + tmpSectorBuf = (uint8 *) TCalloc (sectorSize); if (!tmpSectorBuf) { nStatus = ERR_OUTOFMEMORY; goto closing_seq; } nStatus = OpenBackupHeader (dev, devicePath, password, pkcs5_prf, pim, &masterCryptoInfo, headerCryptoInfo, deviceSize); if (nStatus != ERR_SUCCESS) goto closing_seq; #ifdef _WIN64 if (bIsRamEncryptionEnabled) { VcProtectKeys (masterCryptoInfo, VcGetEncryptionID (masterCryptoInfo)); VcProtectKeys (headerCryptoInfo, VcGetEncryptionID (headerCryptoInfo)); } #endif if (masterCryptoInfo->LegacyVolume) { Error ("NONSYS_INPLACE_DECRYPTION_BAD_VOL_FORMAT", hwndDlg); nStatus = ERR_DONT_REPORT; goto closing_seq; } if (masterCryptoInfo->hiddenVolume) { Error ("NONSYS_INPLACE_DECRYPTION_CANT_DECRYPT_HID_VOL", hwndDlg); @@ -1593,61 +1593,61 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile memset (tmpSectorBuf, 0, sectorSize); skippedBadSectorCount++; } memcpy (buf + tmpBufOffset, tmpSectorBuf, sectorSize); tmpSectorOffset.QuadPart += sectorSize; tmpBufOffset += sectorSize; } } else { SetLastError (dwTmpErr); // Preserve the original error code nStatus = ERR_OS_ERROR; goto closing_seq; } } else { SetLastError (dwTmpErr); // Preserve the original error code nStatus = ERR_OS_ERROR; goto closing_seq; } } // Decrypt the ciphertext in RAM - DecryptDataUnits ((byte *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo); + DecryptDataUnits ((uint8 *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo); // Conceal initial portion of the filesystem if (workChunkStartByteOffset - TC_VOLUME_DATA_OFFSET < TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE) { // We are decrypting the initial TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE bytes of the filesystem. We will // conceal this portion to prevent Windows and applications from interfering with the volume. for (i = 0; i < min (TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE, workChunkStartByteOffset - TC_VOLUME_DATA_OFFSET + workChunkSize); i++) buf[i] ^= TC_NTFS_CONCEAL_CONSTANT; } // Write the plaintext offset.QuadPart = workChunkStartByteOffset - TC_VOLUME_DATA_OFFSET; if (MoveFilePointer (dev, offset) == 0) { nStatus = ERR_OS_ERROR; goto closing_seq; } if (WriteFile (dev, buf, workChunkSize, &n, NULL) == 0) { // Write error nStatus = ERR_OS_ERROR; goto closing_seq; @@ -1816,125 +1816,125 @@ closing_seq: TCfree (tmpSectorBuf); tmpSectorBuf = NULL; } if (skippedBadSectorCount > 0) { wchar_t msg[30000] = {0}; wchar_t sizeStr[500] = {0}; GetSizeString (skippedBadSectorCount * sectorSize, sizeStr, sizeof(sizeStr)); StringCbPrintfW (msg, sizeof(msg), GetString ("SKIPPED_BAD_SECTOR_COUNT"), skippedBadSectorCount, sizeStr); WarningDirect (msg, hwndDlg); } if (nStatus != ERR_SUCCESS && nStatus != ERR_USER_ABORT) SetLastError (dwError); return nStatus; } int FastVolumeHeaderUpdate (HANDLE dev, CRYPTO_INFO *headerCryptoInfo, CRYPTO_INFO *masterCryptoInfo, __int64 deviceSize) { LARGE_INTEGER offset; DWORD n; int nStatus = ERR_SUCCESS; - byte *header; + uint8 *header; DWORD dwError; uint32 headerCrc32; - byte *fieldPos; + uint8 *fieldPos; PCRYPTO_INFO pCryptoInfo = headerCryptoInfo; #ifdef _WIN64 BOOL bIsRamEncryptionEnabled = IsRamEncryptionEnabled(); #endif - header = (byte *) TCalloc (TC_VOLUME_HEADER_EFFECTIVE_SIZE); + header = (uint8 *) TCalloc (TC_VOLUME_HEADER_EFFECTIVE_SIZE); if (!header) return ERR_OUTOFMEMORY; VirtualLock (header, TC_VOLUME_HEADER_EFFECTIVE_SIZE); - fieldPos = (byte *) header + TC_HEADER_OFFSET_ENCRYPTED_AREA_START; + fieldPos = (uint8 *) header + TC_HEADER_OFFSET_ENCRYPTED_AREA_START; offset.QuadPart = deviceSize - TC_VOLUME_HEADER_GROUP_SIZE; if (MoveFilePointer (dev, offset) == 0 || !ReadEffectiveVolumeHeader (TRUE, dev, header, &n) || n < TC_VOLUME_HEADER_EFFECTIVE_SIZE) { nStatus = ERR_OS_ERROR; goto closing_seq; } #ifdef _WIN64 if (bIsRamEncryptionEnabled) { pCryptoInfo = crypto_open(); if (!pCryptoInfo) { nStatus = ERR_OUTOFMEMORY; goto closing_seq; } memcpy (pCryptoInfo, headerCryptoInfo, sizeof (CRYPTO_INFO)); VcUnprotectKeys (pCryptoInfo, VcGetEncryptionID (headerCryptoInfo)); } #endif DecryptBuffer (header + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, pCryptoInfo); if (GetHeaderField32 (header, TC_HEADER_OFFSET_MAGIC) != 0x56455241) { nStatus = ERR_PARAMETER_INCORRECT; goto closing_seq; } mputInt64 (fieldPos, (masterCryptoInfo->EncryptedAreaStart.Value)); mputInt64 (fieldPos, (masterCryptoInfo->EncryptedAreaLength.Value)); // We need to ensure the TC_HEADER_FLAG_NONSYS_INPLACE_ENC flag bit is set, because if volumes created by TC-format // were decrypted in place, it would be possible to mount them partially encrypted and it wouldn't be possible // to resume interrupted decryption after the wizard exits. masterCryptoInfo->HeaderFlags |= TC_HEADER_FLAG_NONSYS_INPLACE_ENC; - fieldPos = (byte *) header + TC_HEADER_OFFSET_FLAGS; + fieldPos = (uint8 *) header + TC_HEADER_OFFSET_FLAGS; mputLong (fieldPos, (masterCryptoInfo->HeaderFlags)); headerCrc32 = GetCrc32 (header + TC_HEADER_OFFSET_MAGIC, TC_HEADER_OFFSET_HEADER_CRC - TC_HEADER_OFFSET_MAGIC); - fieldPos = (byte *) header + TC_HEADER_OFFSET_HEADER_CRC; + fieldPos = (uint8 *) header + TC_HEADER_OFFSET_HEADER_CRC; mputLong (fieldPos, headerCrc32); EncryptBuffer (header + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, pCryptoInfo); if (MoveFilePointer (dev, offset) == 0 || !WriteEffectiveVolumeHeader (TRUE, dev, header)) { nStatus = ERR_OS_ERROR; goto closing_seq; } closing_seq: dwError = GetLastError(); #ifdef _WIN64 if (bIsRamEncryptionEnabled && pCryptoInfo) { crypto_close(pCryptoInfo); } #endif burn (header, TC_VOLUME_HEADER_EFFECTIVE_SIZE); VirtualUnlock (header, TC_VOLUME_HEADER_EFFECTIVE_SIZE); TCfree (header); if (nStatus != ERR_SUCCESS) SetLastError (dwError); @@ -2181,94 +2181,97 @@ BOOL SaveNonSysInPlaceEncSettings (int delta, WipeAlgorithmId newWipeAlgorithm, } else if (!bDecrypt) { if (newWipeAlgorithm != TC_WIPE_NONE) { StringCbPrintfA (str, sizeof(str), "%d", (int) newWipeAlgorithm); SaveBufferToFile (str, GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE), (DWORD) strlen(str), FALSE, FALSE); } else if (FileExists (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE))) { _wremove (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE)); } } StringCbPrintfA (str, sizeof(str), "%d", count); return SaveBufferToFile (str, GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC), (DWORD) strlen(str), FALSE, FALSE); } // This function moves the file pointer to the given offset. It first retrieves the current // file position using SetFilePointerEx() with FILE_CURRENT as the reference point, and then // calculates the difference between the current position and the desired position. Subsequently, // it moves the file pointer by the difference calculated using SetFilePointerEx() again. // // This approach of moving the file pointer relatively (instead of absolutely) was implemented // as a workaround to address the performance issues related to in-place encryption. When using // SetFilePointerEx() with FILE_BEGIN as the reference point, reaching the end of large drives // during in-place encryption can cause significant slowdowns. By moving the file pointer // relatively, these performance issues are mitigated. +// +// We fall back to absolute positioning if the relative positioning fails. BOOL MoveFilePointer (HANDLE dev, LARGE_INTEGER offset) { LARGE_INTEGER currOffset; LARGE_INTEGER diffOffset; currOffset.QuadPart = 0; - if (SetFilePointerEx (dev, currOffset, &currOffset, FILE_CURRENT) == 0) - return FALSE; - - diffOffset.QuadPart = offset.QuadPart - currOffset.QuadPart; - if (diffOffset.QuadPart == 0) - return TRUE; + if (SetFilePointerEx (dev, currOffset, &currOffset, FILE_CURRENT)) + { + diffOffset.QuadPart = offset.QuadPart - currOffset.QuadPart; + if (diffOffset.QuadPart == 0) + return TRUE; - // Moves the file pointer by the difference between current and desired positions - if (SetFilePointerEx (dev, diffOffset, NULL, FILE_CURRENT) == 0) - return FALSE; + // Moves the file pointer by the difference between current and desired positions + if (SetFilePointerEx (dev, diffOffset, NULL, FILE_CURRENT)) + return TRUE; + } - return TRUE; + // An error occurred, fallback to absolute positioning + return SetFilePointerEx (dev, offset, NULL, FILE_BEGIN); } // Repairs damaged sectors (i.e. those with read errors) by zeroing them. // Note that this operating fails if there are any write errors. int ZeroUnreadableSectors (HANDLE dev, LARGE_INTEGER startOffset, int64 size, int sectorSize, uint64 *zeroedSectorCount) { int nStatus; DWORD n; int64 sectorCount; LARGE_INTEGER workOffset; - byte *sectorBuffer = NULL; + uint8 *sectorBuffer = NULL; DWORD dwError; workOffset.QuadPart = startOffset.QuadPart; - sectorBuffer = (byte *) TCalloc (sectorSize); + sectorBuffer = (uint8 *) TCalloc (sectorSize); if (!sectorBuffer) return ERR_OUTOFMEMORY; if (!MoveFilePointer(dev, workOffset)) { nStatus = ERR_OS_ERROR; goto closing_seq; } for (sectorCount = size / sectorSize; sectorCount > 0; --sectorCount) { if (ReadFile (dev, sectorBuffer, sectorSize, &n, NULL) == 0) { memset (sectorBuffer, 0, sectorSize); // If ReadFile failed, move back to start of the unreadable sector if (MoveFilePointer (dev, workOffset) == 0) { nStatus = ERR_OS_ERROR; goto closing_seq; } if (WriteFile (dev, sectorBuffer, sectorSize, &n, NULL) == 0) { nStatus = ERR_OS_ERROR; goto closing_seq; } ++(*zeroedSectorCount); @@ -2285,93 +2288,93 @@ closing_seq: if (sectorBuffer != NULL) TCfree (sectorBuffer); if (nStatus != ERR_SUCCESS) SetLastError (dwError); return nStatus; } static int OpenBackupHeader (HANDLE dev, const wchar_t *devicePath, Password *password, int pkcs5, int pim, PCRYPTO_INFO *retMasterCryptoInfo, CRYPTO_INFO *headerCryptoInfo, __int64 deviceSize) { LARGE_INTEGER offset; DWORD n; int nStatus = ERR_SUCCESS; char *header; DWORD dwError; header = (char *) TCalloc (TC_VOLUME_HEADER_EFFECTIVE_SIZE); if (!header) return ERR_OUTOFMEMORY; VirtualLock (header, TC_VOLUME_HEADER_EFFECTIVE_SIZE); offset.QuadPart = deviceSize - TC_VOLUME_HEADER_GROUP_SIZE; if (MoveFilePointer (dev, offset) == 0 - || !ReadEffectiveVolumeHeader (TRUE, dev, (byte *) header, &n) || n < TC_VOLUME_HEADER_EFFECTIVE_SIZE) + || !ReadEffectiveVolumeHeader (TRUE, dev, (uint8 *) header, &n) || n < TC_VOLUME_HEADER_EFFECTIVE_SIZE) { nStatus = ERR_OS_ERROR; goto closing_seq; } nStatus = ReadVolumeHeader (FALSE, header, password, pkcs5, pim, retMasterCryptoInfo, headerCryptoInfo); if (nStatus != ERR_SUCCESS) goto closing_seq; closing_seq: dwError = GetLastError(); burn (header, TC_VOLUME_HEADER_EFFECTIVE_SIZE); VirtualUnlock (header, TC_VOLUME_HEADER_EFFECTIVE_SIZE); TCfree (header); dwError = GetLastError(); if (nStatus != ERR_SUCCESS) SetLastError (dwError); return nStatus; } static BOOL GetFreeClusterBeforeThreshold (HANDLE volumeHandle, int64 *freeCluster, int64 clusterThreshold) { const int bitmapSize = 65536; - byte bitmapBuffer[bitmapSize + sizeof (VOLUME_BITMAP_BUFFER)]; + uint8 bitmapBuffer[bitmapSize + sizeof (VOLUME_BITMAP_BUFFER)]; VOLUME_BITMAP_BUFFER *bitmap = (VOLUME_BITMAP_BUFFER *) bitmapBuffer; STARTING_LCN_INPUT_BUFFER startLcn; startLcn.StartingLcn.QuadPart = 0; DWORD bytesReturned; while (DeviceIoControl (volumeHandle, FSCTL_GET_VOLUME_BITMAP, &startLcn, sizeof (startLcn), &bitmapBuffer, sizeof (bitmapBuffer), &bytesReturned, NULL) || GetLastError() == ERROR_MORE_DATA) { for (int64 bitmapIndex = 0; bitmapIndex < min (bitmapSize, (bitmap->BitmapSize.QuadPart / 8)); ++bitmapIndex) { if (bitmap->StartingLcn.QuadPart + bitmapIndex * 8 >= clusterThreshold) goto err; if (bitmap->Buffer[bitmapIndex] != 0xff) { for (int bit = 0; bit < 8; ++bit) { if ((bitmap->Buffer[bitmapIndex] & (1 << bit)) == 0) { *freeCluster = bitmap->StartingLcn.QuadPart + bitmapIndex * 8 + bit; if (*freeCluster >= clusterThreshold) goto err; return TRUE; } } } } diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 8e95d0a4..658d3797 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -1079,78 +1079,60 @@ BOOL SwitchWizardToSysEncMode (void) NormalCursor (); return FALSE; } if (!ChangeWizardMode (WIZARD_MODE_SYS_DEVICE)) { NormalCursor (); return FALSE; } if (bSysDriveSelected || bSysPartitionSelected) { // The user selected the non-sys-device wizard mode but then selected a system device bWholeSysDrive = (bSysDriveSelected && !bSysPartitionSelected); bSysDriveSelected = FALSE; bSysPartitionSelected = FALSE; try { if (!bHiddenVol) { if (bWholeSysDrive && !BootEncObj->SystemPartitionCoversWholeDrive()) { if (BootEncObj->SystemDriveContainsNonStandardPartitions()) { if (AskWarnYesNoString ((wstring (GetString ("SYSDRIVE_NON_STANDARD_PARTITIONS")) + L"\n\n" + GetString ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE")).c_str(), MainDlg) == IDYES) bWholeSysDrive = FALSE; } - - if (!IsOSAtLeast (WIN_VISTA) && bWholeSysDrive) - { - if (BootEncObj->SystemDriveContainsExtendedPartition()) - { - bWholeSysDrive = FALSE; - - Error ("WDE_UNSUPPORTED_FOR_EXTENDED_PARTITIONS", MainDlg); - - if (AskYesNo ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE", MainDlg) == IDNO) - { - ChangeWizardMode (WIZARD_MODE_NONSYS_DEVICE); - return FALSE; - } - } - else - Warning ("WDE_EXTENDED_PARTITIONS_WARNING", MainDlg); - } } else if (BootEncObj->SystemPartitionCoversWholeDrive() && !bWholeSysDrive) bWholeSysDrive = (AskYesNo ("WHOLE_SYC_DEVICE_RECOM", MainDlg) == IDYES); } } catch (Exception &e) { e.Show (MainDlg); return FALSE; } if (!bHiddenVol) { // Skip SYSENC_SPAN_PAGE and SYSENC_TYPE_PAGE as the user already made the choice LoadPage (MainDlg, bWholeSysDrive ? SYSENC_PRE_DRIVE_ANALYSIS_PAGE : SYSENC_MULTI_BOOT_MODE_PAGE); } else { // The user selected the non-sys-device wizard mode but then selected a system device. // In addition, he selected the hidden volume mode. if (bWholeSysDrive) Warning ("HIDDEN_OS_PRECLUDES_SINGLE_KEY_WDE", MainDlg); bWholeSysDrive = FALSE; LoadPage (MainDlg, SYSENC_TYPE_PAGE); } @@ -4466,63 +4448,65 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PASSWORD_TITLE")); SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT")); SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV")); EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE); VerifyPasswordAndUpdate (hwndDlg, GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetDlgItem (hwndDlg, IDC_PASSWORD), GetDlgItem (hwndDlg, IDC_VERIFY), NULL, NULL, KeyFilesEnable && FirstKeyFile!=NULL && !SysEncInEffect()); volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text); } break; case PIM_PAGE: { SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, SysEncInEffect()? MAX_BOOT_PIM: MAX_PIM, 0); if (volumePim > 0) { SetPim (hwndDlg, IDC_PIM, volumePim); PimValueChangedWarning = TRUE; SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING")); } SetFocus (GetDlgItem (hwndDlg, IDC_PIM)); - + #ifndef WOLFCRYPT_BACKEND SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (SysEncInEffect () && hash_algo != SHA512 && hash_algo != WHIRLPOOL? "PIM_SYSENC_HELP" : "PIM_HELP")); - + #else + SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (SysEncInEffect () && hash_algo != SHA512? "PIM_SYSENC_HELP" : "PIM_HELP")); + #endif ToHyperlink (hwndDlg, IDC_LINK_PIM_INFO); if (CreatingHiddenSysVol()) SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PIM_HIDDEN_OS_TITLE")); else if (bHiddenVol) SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString (bHiddenVolHost ? "PIM_HIDVOL_HOST_TITLE" : "PIM_HIDVOL_TITLE")); else if (WizardMode == WIZARD_MODE_SYS_DEVICE) SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PIM")); else SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PIM_TITLE")); SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("NEXT")); SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_PREV), GetString ("PREV")); EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE); EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE); } break; case FILESYS_PAGE: { wchar_t szTmp[8192]; Init2RadButtonPageYesNo (nNeedToStoreFilesOver4GB); SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("FILESYS_PAGE_TITLE")); StringCbCopyW (szTmp, sizeof(szTmp), GetString ("FILESYS_PAGE_HELP_QUESTION")); if (bHiddenVolHost) StringCbCatW (szTmp, sizeof(szTmp), L"\n\n"); @@ -5075,61 +5059,61 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa EnableWindow (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), TRUE); /* Filesystems */ bNTFSallowed = FALSE; bFATallowed = FALSE; bNoFSallowed = FALSE; SendMessage (GetDlgItem (hwndDlg, IDC_FILESYS), CB_RESETCONTENT, 0, 0); EnableWindow (GetDlgItem (hwndDlg, IDC_FILESYS), TRUE); uint64 dataAreaSize = GetVolumeDataAreaSize (bHiddenVol && !bHiddenVolHost, nVolumeSize); if (!CreatingHiddenSysVol()) { if (dataAreaSize >= TC_MIN_NTFS_FS_SIZE && dataAreaSize <= TC_MAX_NTFS_FS_SIZE) { AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"NTFS", FILESYS_NTFS); bNTFSallowed = TRUE; } if (dataAreaSize >= TC_MIN_FAT_FS_SIZE && dataAreaSize <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize()) { AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"FAT", FILESYS_FAT); bFATallowed = TRUE; } //exFAT support added starting from Vista SP1 - if (IsOSVersionAtLeast (WIN_VISTA, 1) && dataAreaSize >= TC_MIN_EXFAT_FS_SIZE && dataAreaSize <= TC_MAX_EXFAT_FS_SIZE) + if (dataAreaSize >= TC_MIN_EXFAT_FS_SIZE && dataAreaSize <= TC_MAX_EXFAT_FS_SIZE) { AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"exFAT", FILESYS_EXFAT); bEXFATallowed = TRUE; } //ReFS write support activated by default starting from Windows 10 //We don't support it yet for the creation of hidden volumes if ((!bHiddenVolHost) && IsOSVersionAtLeast (WIN_10, 0) && dataAreaSize >= TC_MIN_REFS_FS_SIZE && dataAreaSize <= TC_MAX_REFS_FS_SIZE) { AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"ReFS", FILESYS_REFS); bReFSallowed = TRUE; } } else { // We're creating a hidden volume for a hidden OS, so we don't need to format it with // any filesystem (the entire OS will be copied to the hidden volume sector by sector). EnableWindow (GetDlgItem (hwndDlg, IDC_FILESYS), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), FALSE); } if (!bHiddenVolHost) { AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), GetString ("NONE"), FILESYS_NONE); bNoFSallowed = TRUE; } EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE); if (fileSystem == FILESYS_NONE) // If no file system has been previously selected @@ -5894,61 +5878,61 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa case IDC_GB: SendMessage (GetDlgItem (hwndDlg, IDC_GB), BM_SETCHECK, BST_CHECKED, 0); break; case IDC_TB: SendMessage (GetDlgItem (hwndDlg, IDC_TB), BM_SETCHECK, BST_CHECKED, 0); break; } VerifySizeAndUpdate (hwndDlg, FALSE); return 1; } if (lw == IDC_HIDVOL_WIZ_MODE_DIRECT && nCurPageNo == HIDDEN_VOL_WIZARD_MODE_PAGE) { bHiddenVolDirect = TRUE; return 1; } if (lw == IDC_HIDVOL_WIZ_MODE_FULL && nCurPageNo == HIDDEN_VOL_WIZARD_MODE_PAGE) { bHiddenVolDirect = FALSE; return 1; } if (lw == IDC_SELECT_VOLUME_LOCATION && nCurPageNo == VOLUME_LOCATION_PAGE) { if (!bDevice) { // Select file - if (BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, !bHiddenVolDirect, NULL) == FALSE) + if (BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, !bHiddenVolDirect) == FALSE) return 1; AddComboItem (GetDlgItem (hwndDlg, IDC_COMBO_BOX), szFileName, bHistory); EnableDisableFileNext (GetDlgItem (hwndDlg, IDC_COMBO_BOX), GetDlgItem (GetParent (hwndDlg), IDC_NEXT)); return 1; } else { // Select device RawDevicesDlgParam param; param.pszFileName = szFileName; INT_PTR nResult = DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_RAWDEVICES_DLG), GetParent (hwndDlg), (DLGPROC) RawDevicesDlgProc, (LPARAM) & param); // Check administrator privileges if (!wcsstr (szFileName, L"Floppy") && !IsAdmin() && !IsUacSupported ()) MessageBoxW (hwndDlg, GetString ("ADMIN_PRIVILEGES_WARN_DEVICES"), lpszTitle, MB_OK|MB_ICONWARNING); if (nResult == IDOK && wcslen (szFileName) > 0) { AddComboItem (GetDlgItem (hwndDlg, IDC_COMBO_BOX), szFileName, bHistory); EnableDisableFileNext (GetDlgItem (hwndDlg, IDC_COMBO_BOX), GetDlgItem (GetParent (hwndDlg), IDC_NEXT)); bDeviceTransformModeChoiceMade = FALSE; @@ -6085,61 +6069,61 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowText (GetDlgItem (hCurPage, IDC_RANDOM_BYTES), showKeys ? L" " : L"******************************** "); SetWindowText (GetDlgItem (hCurPage, IDC_HEADER_KEY), showKeys ? L"" : L"******************************** "); SetWindowText (GetDlgItem (hCurPage, IDC_DISK_KEY), showKeys ? L"" : L"******************************** "); return 1; } if (lw == IDC_DISPLAY_POOL_CONTENTS && (nCurPageNo == SYSENC_COLLECTING_RANDOM_DATA_PAGE || nCurPageNo == NONSYS_INPLACE_ENC_RAND_DATA_PAGE)) { showKeys = IsButtonChecked (GetDlgItem (hCurPage, IDC_DISPLAY_POOL_CONTENTS)); DisplayRandPool (hwndDlg, hRandPoolSys, showKeys); return 1; } if (lw == IDC_DISPLAY_KEYS && nCurPageNo == SYSENC_KEYS_GEN_PAGE) { showKeys = IsButtonChecked (GetDlgItem (hCurPage, IDC_DISPLAY_KEYS)); DisplayPortionsOfKeys (GetDlgItem (hwndDlg, IDC_HEADER_KEY), GetDlgItem (hwndDlg, IDC_DISK_KEY), HeaderKeyGUIView, MasterKeyGUIView, !showKeys); return 1; } if (nCurPageNo == SYSENC_RESCUE_DISK_CREATION_PAGE) { if (lw == IDC_BROWSE) { wchar_t tmpszRescueDiskISO [TC_MAX_PATH+1]; - if (!BrowseFiles (hwndDlg, "OPEN_TITLE", tmpszRescueDiskISO, FALSE, TRUE, NULL)) + if (!BrowseFiles (hwndDlg, "OPEN_TITLE", tmpszRescueDiskISO, FALSE, TRUE)) return 1; StringCbCopyW (szRescueDiskISO, sizeof(szRescueDiskISO), tmpszRescueDiskISO); SetDlgItemText (hwndDlg, IDC_RESCUE_DISK_ISO_PATH, szRescueDiskISO); EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), (GetWindowTextLength (GetDlgItem (hwndDlg, IDC_RESCUE_DISK_ISO_PATH)) > 1)); return 1; } if ( hw == EN_CHANGE ) { GetDlgItemText (hwndDlg, IDC_RESCUE_DISK_ISO_PATH, szRescueDiskISO, sizeof(szRescueDiskISO)); EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), (GetWindowTextLength (GetDlgItem (hwndDlg, IDC_RESCUE_DISK_ISO_PATH)) > 1)); return 1; } } if (nCurPageNo == SYSENC_RESCUE_DISK_BURN_PAGE && lw == IDC_DOWNLOAD_CD_BURN_SOFTWARE) { if (IsWindowsIsoBurnerAvailable()) LaunchWindowsIsoBurner (hwndDlg, szRescueDiskISO); else Applink ("isoburning"); return 1; } if ((nCurPageNo == SYSENC_WIPE_MODE_PAGE || nCurPageNo == NONSYS_INPLACE_ENC_WIPE_MODE_PAGE || nCurPageNo == DEVICE_WIPE_MODE_PAGE) @@ -6230,61 +6214,61 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SysEncMultiBootCfg.SystemOnBootDrive = -1; try { BootEncStatus = BootEncObj->GetStatus(); } catch (Exception &e) { e.Show (hwndDlg); Error ("ERR_GETTING_SYSTEM_ENCRYPTION_STATUS", MainDlg); EndMainDlg (MainDlg); return 0; } try { bSystemIsGPT = BootEncObj->GetSystemDriveConfiguration().SystemPartition.IsGPT; } catch (...) { } SendMessageW (GetDlgItem (hwndDlg, IDC_BOX_TITLE), WM_SETFONT, (WPARAM) hTitleFont, (LPARAM) TRUE); SetWindowTextW (hwndDlg, lpszTitle); ExtractCommandLine (hwndDlg, (wchar_t *) lParam); if (EnableMemoryProtection) { /* Protect this process memory from being accessed by non-admin users */ - EnableProcessProtection (); + ActivateMemoryProtection (); } if (ComServerMode) { InitDialog (hwndDlg); if (!ComServerFormat ()) { handleWin32Error (hwndDlg, SRC_POS); exit (1); } exit (0); } fastCreateFile = CmdFastCreateFile; if (DirectCreationMode) { wchar_t root[TC_MAX_PATH]; DWORD fileSystemFlags = 0; uint64 dataAreaSize; wchar_t szFileSystemNameBuffer[256]; ULARGE_INTEGER free; showKeys = FALSE; bGuiMode = FALSE; if (CmdVolumePassword.Length == 0 && !FirstCmdKeyFile) AbortProcess ("ERR_PASSWORD_MISSING"); @@ -6397,98 +6381,88 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { AbortProcess ("ERR_EXFAT_INVALID_VOLUME_SIZE"); } if ( (fileSystem == FILESYS_REFS) && (dataAreaSize < TC_MIN_REFS_FS_SIZE || dataAreaSize > TC_MAX_REFS_FS_SIZE) ) { AbortProcess ("ERR_REFS_INVALID_VOLUME_SIZE"); } if ( (fileSystem == FILESYS_FAT) && (dataAreaSize < TC_MIN_FAT_FS_SIZE || dataAreaSize > (TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize())) ) { AbortProcess ("ERR_FAT_INVALID_VOLUME_SIZE"); } /* Verify that the volume would not be too large for the host file system */ if (GetVolumePathName (szDiskFile, root, ARRAYSIZE (root)) && GetVolumeInformation (root, NULL, 0, NULL, NULL, NULL, szFileSystemNameBuffer, ARRAYSIZE(szFileSystemNameBuffer)) && !wcsncmp (szFileSystemNameBuffer, L"FAT32", 5)) { // The host file system is FAT32 if (nVolumeSize >= 4 * BYTES_PER_GB) { AbortProcess ("VOLUME_TOO_LARGE_FOR_FAT32"); } } - /* Verify that the volume would not be too large for the operating system */ - if (!IsOSAtLeast (WIN_VISTA) - && nVolumeSize > 2 * BYTES_PER_TB) - { - AbortProcess ("VOLUME_TOO_LARGE_FOR_WINXP"); - } - if (volumePassword.Length > 0) { // Check password length (check also done for outer volume which is not the case in TrueCrypt). if (!CheckPasswordLength (NULL, volumePassword.Length, volumePim, FALSE, 0, Silent, Silent)) { exit (1); } } if (!KeyFilesApply (hwndDlg, &volumePassword, FirstCmdKeyFile, NULL)) { exit (1); } volTransformThreadFunction (hwndDlg); exit (bOperationSuccess? 0 : 1); } SHGetFolderPath (NULL, CSIDL_MYDOCUMENTS, NULL, 0, szRescueDiskISO); if (bSystemIsGPT) StringCbCatW (szRescueDiskISO, sizeof(szRescueDiskISO), L"\\VeraCrypt Rescue Disk.zip"); else StringCbCatW (szRescueDiskISO, sizeof(szRescueDiskISO), L"\\VeraCrypt Rescue Disk.iso"); - if (IsOSAtLeast (WIN_VISTA)) - { - // Availability of in-place encryption (which is pre-selected by default whenever - // possible) makes partition-hosted volume creation safer. - bWarnDeviceFormatAdvanced = FALSE; - } + // Availability of in-place encryption (which is pre-selected by default whenever + // possible) makes partition-hosted volume creation safer. + bWarnDeviceFormatAdvanced = FALSE; #ifdef _DEBUG // For faster testing StringCchCopyA (szVerify, ARRAYSIZE(szVerify), "q"); StringCchCopyA (szRawPassword, ARRAYSIZE(szRawPassword), "q"); #endif PasswordEditDropTarget* pTarget = new PasswordEditDropTarget (); if (pTarget->Register (hwndDlg)) { SetWindowLongPtr (hwndDlg, DWLP_USER, (LONG_PTR) pTarget); } else delete pTarget; PostMessage (hwndDlg, TC_APPMSG_PERFORM_POST_WMINIT_TASKS, 0, 0); } return 0; case WM_SYSCOMMAND: if (lw == IDC_ABOUT) { DialogBoxW (hInst, MAKEINTRESOURCEW (IDD_ABOUT_DLG), hwndDlg, (DLGPROC) AboutDlgProc); return 1; } return 0; case WM_TIMER: switch (wParam) @@ -7211,134 +7185,118 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa return 1; } } // This check requires admin rights try { BootEncObj->InitialSecurityChecksForHiddenOS (); } catch (Exception &e) { e.Show (hwndDlg); EndMainDlg (MainDlg); // Some of the checks need the wizard to be restarted (results are cached until exit and the checks would fail even if the issues were rectified). return 1; } nNewPageNo = SYSENC_MULTI_BOOT_MODE_PAGE - 1; // Skip irrelevant pages } else if (nCurPageNo == SYSENC_SPAN_PAGE) { try { if (bWholeSysDrive && !BootEncObj->SystemPartitionCoversWholeDrive()) { if (BootEncObj->SystemDriveContainsNonStandardPartitions()) { if (AskWarnYesNoString ((wstring (GetString ("SYSDRIVE_NON_STANDARD_PARTITIONS")) + L"\n\n" + GetString ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE")).c_str(), MainDlg) == IDYES) bWholeSysDrive = FALSE; } - - if (!IsOSAtLeast (WIN_VISTA) && bWholeSysDrive) - { - if (BootEncObj->SystemDriveContainsExtendedPartition()) - { - Error ("WDE_UNSUPPORTED_FOR_EXTENDED_PARTITIONS", MainDlg); - - if (AskYesNo ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE", MainDlg) == IDNO) - return 1; - - bWholeSysDrive = FALSE; - } - else - Warning ("WDE_EXTENDED_PARTITIONS_WARNING", hwndDlg); - } } if (!bWholeSysDrive && BootEncObj->SystemPartitionCoversWholeDrive()) bWholeSysDrive = (AskYesNo ("WHOLE_SYC_DEVICE_RECOM", hwndDlg) == IDYES); } catch (Exception &e) { e.Show (hwndDlg); NormalCursor (); return 1; } if (!bWholeSysDrive) nNewPageNo = SYSENC_MULTI_BOOT_MODE_PAGE - 1; // Skip irrelevant pages } else if (nCurPageNo == SYSENC_PRE_DRIVE_ANALYSIS_PAGE) { if ((SysEncDetectHiddenSectors = Get2RadButtonPageAnswer()) != 1) { // Skip drive analysis nNewPageNo = SYSENC_DRIVE_ANALYSIS_PAGE; // If the user had already searched for hidden sectors, we must clear (invalidate) the // result because now he changed his mind and no longer wishes to encrypt the hidden sectors. try { BootEncObj->InvalidateCachedSysDriveProperties (); } catch (Exception &e) { e.Show (MainDlg); EndMainDlg (MainDlg); exit(0); } } } else if (nCurPageNo == SYSENC_MULTI_BOOT_MODE_PAGE) { if (nMultiBoot > 1) { // Multi-boot if (AskWarnNoYes ("MULTI_BOOT_FOR_ADVANCED_ONLY", hwndDlg) == IDNO) return 1; if (bHiddenOS) { if (AskWarnNoYes ("HIDDEN_OS_MULTI_BOOT", hwndDlg) == IDNO) { Error ("UNSUPPORTED_HIDDEN_OS_MULTI_BOOT_CFG", hwndDlg); return 1; } } } if (bHiddenOS) { - if (IsOSAtLeast (WIN_7) - && BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent + if (BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent && AskWarnYesNo ("CONFIRM_HIDDEN_OS_EXTRA_BOOT_PARTITION", hwndDlg) == IDNO) { TextInfoDialogBox (TC_TBXID_EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS); NormalCursor (); return 1; } if (AskWarnYesNo ("DECOY_OS_REQUIREMENTS", hwndDlg) == IDNO) { NormalCursor (); return 1; } if (!ChangeWizardMode (WIZARD_MODE_NONSYS_DEVICE)) { NormalCursor (); return 1; } // Skip irrelevant pages nNewPageNo = HIDDEN_VOL_HOST_PRE_CIPHER_PAGE - 1; } else if ((nMultiBoot <= 1) || bSystemIsGPT) { // Single-boot (not creating a hidden OS) // Multi-boot in case of GPT // Skip irrelevant pages nNewPageNo = CIPHER_PAGE - 1; } @@ -7653,67 +7611,60 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa RandSetHashFunction (hash_algo); if (SysEncInEffect () || bInPlaceEncNonSys) nNewPageNo = PASSWORD_PAGE - 1; // Skip irrelevant pages } else if (nCurPageNo == SIZE_PAGE) { wchar_t szFileSystemNameBuffer[256]; VerifySizeAndUpdate (hCurPage, TRUE); if (!bDevice) { /* Verify that the volume would not be too large for the host file system */ wchar_t root[TC_MAX_PATH]; if (GetVolumePathName (szDiskFile, root, ARRAYSIZE (root)) && GetVolumeInformation (root, NULL, 0, NULL, NULL, NULL, szFileSystemNameBuffer, ARRAYSIZE(szFileSystemNameBuffer)) && !wcsncmp (szFileSystemNameBuffer, L"FAT32", 5)) { // The host file system is FAT32 if (nUIVolumeSize * nMultiplier >= 4 * BYTES_PER_GB) { Error ("VOLUME_TOO_LARGE_FOR_FAT32", hwndDlg); return 1; } } - /* Verify that the volume would not be too large for the operating system */ - - if (!IsOSAtLeast (WIN_VISTA) - && nUIVolumeSize * nMultiplier > 2 * BYTES_PER_TB) - { - Warning ("VOLUME_TOO_LARGE_FOR_WINXP", hwndDlg); - } } if (bHiddenVol && !bHiddenVolHost) // If it's a hidden volume { /* Ask for confirmation if the hidden volume is too large for the user to be able to write much more data to the outer volume. */ if (((double) nUIVolumeSize / (nMaximumHiddenVolSize / nMultiplier)) > 0.85) // 85% { if (AskWarnNoYes ("FREE_SPACE_FOR_WRITING_TO_OUTER_VOLUME", hwndDlg) == IDNO) return 1; } } if (!(bHiddenVolDirect && bHiddenVolHost)) nNewPageNo = PASSWORD_PAGE - 1; } else if (nCurPageNo == PASSWORD_PAGE) { VerifyPasswordAndUpdate (hwndDlg, GetDlgItem (MainDlg, IDC_NEXT), GetDlgItem (hCurPage, IDC_PASSWORD), GetDlgItem (hCurPage, IDC_VERIFY), volumePassword.Text, szVerify, KeyFilesEnable && FirstKeyFile!=NULL && !SysEncInEffect()); volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text); if (volumePassword.Length > 0) @@ -9262,61 +9213,61 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) else AbortProcess ("COMMAND_LINE_ERROR"); } break; case OptionEncryption: { wchar_t szTmp[64] = {0}; if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp))) { CmdVolumeEA = EAGetByName (szTmp); if (CmdVolumeEA == 0) AbortProcess ("COMMAND_LINE_ERROR"); } else AbortProcess ("COMMAND_LINE_ERROR"); } break; case OptionFilesystem: { wchar_t szTmp[8] = {0}; if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp))) { if (_wcsicmp(szTmp, L"NONE") == 0) CmdVolumeFilesystem = FILESYS_NONE; else if (_wcsicmp(szTmp, L"FAT32") == 0 || _wcsicmp(szTmp, L"FAT") == 0) CmdVolumeFilesystem = FILESYS_FAT; else if (_wcsicmp(szTmp, L"NTFS") == 0) CmdVolumeFilesystem = FILESYS_NTFS; - else if (IsOSVersionAtLeast (WIN_VISTA, 1) && _wcsicmp(szTmp, L"EXFAT") == 0) + else if (_wcsicmp(szTmp, L"EXFAT") == 0) CmdVolumeFilesystem = FILESYS_EXFAT; else if (IsOSVersionAtLeast (WIN_10, 0) && _wcsicmp(szTmp, L"ReFS") == 0) CmdVolumeFilesystem = FILESYS_REFS; else { AbortProcess ("COMMAND_LINE_ERROR"); } } else AbortProcess ("COMMAND_LINE_ERROR"); } break; case OptionPassword: { wchar_t szTmp[MAX_PASSWORD + 1]; if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp))) { int iLen = WideCharToMultiByte (CP_UTF8, 0, szTmp, -1, (LPSTR) CmdVolumePassword.Text, iMaxPasswordLength + 1, NULL, NULL); burn (szTmp, sizeof (szTmp)); if (iLen > 0) CmdVolumePassword.Length = (unsigned __int32) (iLen - 1); else AbortProcess ("COMMAND_LINE_ERROR"); } else AbortProcess ("COMMAND_LINE_ERROR"); } break; case OptionPkcs5: @@ -10623,94 +10574,89 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz VirtualLock (MasterKeyGUIView, sizeof(MasterKeyGUIView)); VirtualLock (HeaderKeyGUIView, sizeof(HeaderKeyGUIView)); VirtualLock (randPool, sizeof(randPool)); VirtualLock (lastRandPool, sizeof(lastRandPool)); VirtualLock (outRandPoolDispBuffer, sizeof(outRandPoolDispBuffer)); VirtualLock (&mouseEntropyGathered, sizeof(mouseEntropyGathered)); VirtualLock (&mouseEventsInitialCount, sizeof(mouseEventsInitialCount)); VirtualLock (maskRandPool, sizeof(maskRandPool)); VirtualLock (&szFileName, sizeof(szFileName)); VirtualLock (&szDiskFile, sizeof(szDiskFile)); DetectX86Features (); try { BootEncObj = new BootEncryption (NULL); } catch (Exception &e) { e.Show (NULL); } if (BootEncObj == NULL) AbortProcess ("INIT_SYS_ENC"); InitApp (hInstance, lpszCommandLine); - // Write block size greater than 64 KB causes a performance drop when writing to files on XP/Vista - if (!IsOSAtLeast (WIN_7)) - FormatWriteBufferSize = 64 * 1024; - #if TC_MAX_VOLUME_SECTOR_SIZE > 64 * 1024 #error TC_MAX_VOLUME_SECTOR_SIZE > 64 * 1024 #endif nPbar = IDC_PROGRESS_BAR; if (Randinit ()) { DWORD dwLastError = GetLastError (); wchar_t szTmp[4096]; if (CryptoAPILastError == ERROR_SUCCESS) StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("INIT_RAND"), SRC_POS, dwLastError); else StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("CAPI_RAND"), SRC_POS, CryptoAPILastError); AbortProcessDirect (szTmp); } RegisterRedTick(hInstance); /* Allocate, dup, then store away the application title */ lpszTitle = GetString ("IDD_VOL_CREATION_WIZARD_DLG"); status = DriverAttach (); if (status != 0) { if (status == ERR_OS_ERROR) handleWin32Error (NULL, SRC_POS); else handleError (NULL, status, SRC_POS); AbortProcess ("NODRIVER"); } if (!AutoTestAlgorithms()) AbortProcess ("ERR_SELF_TESTS_FAILED"); /* Create the main dialog box */ DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_VOL_CREATION_WIZARD_DLG), NULL, (DLGPROC) MainDialogProc, (LPARAM)lpszCommandLine); - FinalizeApp (); return 0; } static DWORD GetFormatSectorSize () { if (!bDevice) return TC_SECTOR_SIZE_FILE_HOSTED_VOLUME; DISK_GEOMETRY_EX geometry; if (!GetDriveGeometry (szDiskFile, &geometry)) { handleWin32Error (MainDlg, SRC_POS); AbortProcessSilent(); } return geometry.Geometry.BytesPerSector; } |