VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Format
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-11-25 00:41:37 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-11-26 00:44:52 (GMT)
commit90bd57fe40e66fc829ecb01482d32d604b0df19c (patch)
tree6d6de0d9a31c82d0598f68c2d160cb9e565bd5ea /src/Format
parentec7d96fcb733021c214b414a1ba2841039733dd2 (diff)
downloadVeraCrypt-90bd57fe40e66fc829ecb01482d32d604b0df19c.zip
VeraCrypt-90bd57fe40e66fc829ecb01482d32d604b0df19c.tar.gz
Windows: Full UNICODE rewrite and implement support for UNICODE passwords.
Diffstat (limited to 'src/Format')
-rw-r--r--src/Format/Format.vcproj188
-rw-r--r--src/Format/InPlace.c66
-rw-r--r--src/Format/InPlace.h8
-rw-r--r--src/Format/Tcformat.cbin633378 -> 633870 bytes
-rw-r--r--src/Format/Tcformat.h6
5 files changed, 166 insertions, 102 deletions
diff --git a/src/Format/Format.vcproj b/src/Format/Format.vcproj
index b5b6a4a..72adc4d 100644
--- a/src/Format/Format.vcproj
+++ b/src/Format/Format.vcproj
@@ -25,7 +25,7 @@
IntermediateDirectory="Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -105,12 +105,12 @@
/>
</Configuration>
<Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -126,21 +126,21 @@
/>
<Tool
Name="VCMIDLTool"
+ TargetEnvironment="3"
TypeLibraryName="$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb"
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalOptions="/w34189"
- Optimization="2"
+ Optimization="0"
AdditionalIncludeDirectories="..\Common;..\Crypto;..\;..\PKCS11"
- PreprocessorDefinitions="VOLFORMAT;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS"
- RuntimeLibrary="0"
+ PreprocessorDefinitions="VOLFORMAT;WIN32;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
BufferSecurityCheck="true"
UsePrecompiledHeader="0"
- AssemblerOutput="2"
- AssemblerListingLocation="$(IntDir)/"
WarningLevel="4"
- DebugInformationFormat="0"
+ DebugInformationFormat="3"
DisableSpecificWarnings="4057;4100;4127;4201;4204;4701;4706"
/>
<Tool
@@ -154,19 +154,17 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="comctl32.lib setupapi.lib ..\Crypto\Release\crypto.lib"
+ AdditionalDependencies="comctl32.lib setupapi.lib ..\Crypto\x64\Debug\crypto.lib"
OutputFile="$(OutDir)/VeraCryptFormat.exe"
- LinkIncremental="1"
+ LinkIncremental="2"
GenerateManifest="false"
IgnoreAllDefaultLibraries="false"
- GenerateDebugInformation="false"
- GenerateMapFile="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(OutDir)/Format.pdb"
SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="2"
- TargetMachine="1"
+ TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
@@ -189,16 +187,16 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="copy Release\VeraCryptFormat.exe &quot;..\Release\Setup Files\VeraCrypt Format.exe&quot;"
+ CommandLine="md &quot;..\Debug\Setup Files&quot; 2&gt;NUL:&#x0D;&#x0A;copy $(TargetPath) &quot;..\Debug\Setup Files\VeraCrypt Format-x64.exe&quot; &gt;NUL:&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
- Name="Debug|x64"
- OutputDirectory="$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -214,21 +212,21 @@
/>
<Tool
Name="VCMIDLTool"
- TargetEnvironment="3"
TypeLibraryName="$(SolutionDir)/$(ProjectName)/$(ProjectName).tlb"
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="0"
+ AdditionalOptions="/w34189"
+ Optimization="2"
AdditionalIncludeDirectories="..\Common;..\Crypto;..\;..\PKCS11"
- PreprocessorDefinitions="VOLFORMAT;WIN32;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
+ PreprocessorDefinitions="VOLFORMAT;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS"
+ RuntimeLibrary="0"
BufferSecurityCheck="true"
UsePrecompiledHeader="0"
+ AssemblerOutput="2"
+ AssemblerListingLocation="$(IntDir)/"
WarningLevel="4"
- DebugInformationFormat="3"
+ DebugInformationFormat="0"
DisableSpecificWarnings="4057;4100;4127;4201;4204;4701;4706"
/>
<Tool
@@ -242,17 +240,19 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="comctl32.lib setupapi.lib ..\Crypto\x64\Debug\crypto.lib"
+ AdditionalDependencies="comctl32.lib setupapi.lib ..\Crypto\Release\crypto.lib"
OutputFile="$(OutDir)/VeraCryptFormat.exe"
- LinkIncremental="2"
+ LinkIncremental="1"
GenerateManifest="false"
IgnoreAllDefaultLibraries="false"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/Format.pdb"
+ GenerateDebugInformation="false"
+ GenerateMapFile="true"
SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="2"
- TargetMachine="17"
+ TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
@@ -275,7 +275,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="md &quot;..\Debug\Setup Files&quot; 2&gt;NUL:&#x0D;&#x0A;copy $(TargetPath) &quot;..\Debug\Setup Files\VeraCrypt Format-x64.exe&quot; &gt;NUL:&#x0D;&#x0A;"
+ CommandLine="copy Release\VeraCryptFormat.exe &quot;..\Release\Setup Files\VeraCrypt Format.exe&quot;"
/>
</Configuration>
<Configuration
@@ -284,7 +284,7 @@
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -396,7 +396,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|Win32"
+ Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
@@ -404,7 +404,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Debug|x64"
+ Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -432,7 +432,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|Win32"
+ Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
@@ -440,7 +440,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Debug|x64"
+ Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -495,7 +495,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|Win32"
+ Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
@@ -503,7 +503,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Debug|x64"
+ Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -531,7 +531,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|Win32"
+ Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
@@ -539,7 +539,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Debug|x64"
+ Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -587,7 +587,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|Win32"
+ Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
@@ -595,7 +595,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Debug|x64"
+ Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -751,11 +751,11 @@
>
</File>
<File
- RelativePath="..\Common\Resource.h"
+ RelativePath=".\resource.h"
>
</File>
<File
- RelativePath=".\resource.h"
+ RelativePath="..\Common\Resource.h"
>
</File>
<File
@@ -797,6 +797,38 @@
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
+ RelativePath="..\Boot\Windows\Release_Serpent_SHA2\BootSector.bin"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Rescue_Twofish_SHA2\BootSector.bin"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Rescue_Serpent_SHA2\BootSector.bin"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Rescue_AES_SHA2\BootSector.bin"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Rescue_SHA2\BootSector.bin"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Release_SHA2\BootSector.bin"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Release_AES_SHA2\BootSector.bin"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Release_Twofish_SHA2\BootSector.bin"
+ >
+ </File>
+ <File
RelativePath=".\Format.manifest"
>
</File>
@@ -810,6 +842,10 @@
>
</File>
<File
+ RelativePath="..\Common\VeraCrypt_mounted.ico"
+ >
+ </File>
+ <File
RelativePath="..\Common\VeraCrypt_Volume.ico"
>
</File>
@@ -821,35 +857,35 @@
Name="Common"
>
<File
- RelativePath="..\Boot\Windows\Rescue\BootLoader.com.gz"
+ RelativePath="..\Boot\Windows\Release_AES\BootLoader.com.gz"
>
</File>
<File
- RelativePath="..\Boot\Windows\Rescue_Twofish\BootLoader.com.gz"
+ RelativePath="..\Boot\Windows\Release\BootLoader.com.gz"
>
</File>
<File
- RelativePath="..\Boot\Windows\Release_Serpent\BootLoader.com.gz"
+ RelativePath="..\Boot\Windows\Release_Twofish\BootLoader.com.gz"
>
</File>
<File
- RelativePath="..\Boot\Windows\Release_AES\BootLoader.com.gz"
+ RelativePath="..\Boot\Windows\Rescue_Serpent\BootLoader.com.gz"
>
</File>
<File
- RelativePath="..\Boot\Windows\Release\BootLoader.com.gz"
+ RelativePath="..\Boot\Windows\Rescue_AES\BootLoader.com.gz"
>
</File>
<File
- RelativePath="..\Boot\Windows\Release_Twofish\BootLoader.com.gz"
+ RelativePath="..\Boot\Windows\Rescue\BootLoader.com.gz"
>
</File>
<File
- RelativePath="..\Boot\Windows\Rescue_Serpent\BootLoader.com.gz"
+ RelativePath="..\Boot\Windows\Rescue_Twofish\BootLoader.com.gz"
>
</File>
<File
- RelativePath="..\Boot\Windows\Rescue_AES\BootLoader.com.gz"
+ RelativePath="..\Boot\Windows\Release_Serpent\BootLoader.com.gz"
>
</File>
<File
@@ -896,7 +932,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|Win32"
+ Name="Debug|x64"
ExcludedFromBuild="true"
>
<Tool
@@ -904,7 +940,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Debug|x64"
+ Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
@@ -950,6 +986,38 @@
</File>
</Filter>
</Filter>
+ <File
+ RelativePath="..\Boot\Windows\Release_Serpent_SHA2\BootLoader.com.gz"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Release_Twofish_SHA2\BootLoader.com.gz"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Rescue_SHA2\BootLoader.com.gz"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Rescue_AES_SHA2\BootLoader.com.gz"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Rescue_Serpent_SHA2\BootLoader.com.gz"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Rescue_Twofish_SHA2\BootLoader.com.gz"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Release_SHA2\BootLoader.com.gz"
+ >
+ </File>
+ <File
+ RelativePath="..\Boot\Windows\Release_AES_SHA2\BootLoader.com.gz"
+ >
+ </File>
</Files>
<Globals>
</Globals>
diff --git a/src/Format/InPlace.c b/src/Format/InPlace.c
index 8d229f4..041f42b 100644
--- a/src/Format/InPlace.c
+++ b/src/Format/InPlace.c
@@ -65,7 +65,7 @@ using namespace VeraCrypt;
// If the returned value is greater than 0, it is the desired volume size in NTFS sectors (not in bytes)
// after shrinking has been performed. If there's any error, returns -1.
-static __int64 NewFileSysSizeAfterShrink (HANDLE dev, const char *devicePath, int64 *totalClusterCount, DWORD *bytesPerCluster, BOOL silent)
+static __int64 NewFileSysSizeAfterShrink (HANDLE dev, const wchar_t *devicePath, int64 *totalClusterCount, DWORD *bytesPerCluster, BOOL silent)
{
NTFS_VOLUME_DATA_BUFFER ntfsVolData;
DWORD nBytesReturned;
@@ -115,17 +115,17 @@ static __int64 NewFileSysSizeAfterShrink (HANDLE dev, const char *devicePath, in
}
-BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const char *devicePath, BOOL silent)
+BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const wchar_t *devicePath, BOOL silent)
{
NTFS_VOLUME_DATA_BUFFER ntfsVolData;
DWORD nBytesReturned;
HANDLE dev;
- char szFileSysName [256];
+ WCHAR szFileSysName [256];
WCHAR devPath [MAX_PATH];
- char dosDev [TC_MAX_PATH] = {0};
- char devName [MAX_PATH] = {0};
+ WCHAR dosDev [TC_MAX_PATH] = {0};
+ WCHAR devName [MAX_PATH] = {0};
int driveLetterNo = -1;
- char szRootPath[4] = {0, ':', '\\', 0};
+ WCHAR szRootPath[4] = {0, L':', L'\\', 0};
__int64 deviceSize;
int partitionNumber = -1, driveNumber = -1;
@@ -146,8 +146,8 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const char *devicePath,
/* Volume type (must be a partition or a dynamic volume) */
- if (sscanf (devicePath, "\\Device\\HarddiskVolume%d", &partitionNumber) != 1
- && sscanf (devicePath, "\\Device\\Harddisk%d\\Partition%d", &driveNumber, &partitionNumber) != 2)
+ if (swscanf (devicePath, L"\\Device\\HarddiskVolume%d", &partitionNumber) != 1
+ && swscanf (devicePath, L"\\Device\\Harddisk%d\\Partition%d", &driveNumber, &partitionNumber) != 2)
{
if (!silent)
Error ("INPLACE_ENC_INVALID_PATH", hwndDlg);
@@ -181,13 +181,12 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const char *devicePath,
/* Access to the partition */
- StringCbCopyA ((char *) devPath, sizeof(devPath), devicePath);
- ToUNICODE ((char *) devPath, sizeof(devPath));
+ StringCbCopyW (devPath, sizeof(devPath), devicePath);
driveLetterNo = GetDiskDeviceDriveLetter (devPath);
if (driveLetterNo >= 0)
- szRootPath[0] = (char) driveLetterNo + 'A';
+ szRootPath[0] = (wchar_t) driveLetterNo + L'A';
if (FakeDosNameForDevice (devicePath, dosDev, sizeof(dosDev), devName, sizeof(devName),FALSE) != 0)
{
@@ -212,9 +211,9 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const char *devicePath,
/* File system type */
- GetVolumeInformation (szRootPath, NULL, 0, NULL, NULL, NULL, szFileSysName, sizeof(szFileSysName));
+ GetVolumeInformation (szRootPath, NULL, 0, NULL, NULL, NULL, szFileSysName, ARRAYSIZE (szFileSysName));
- if (strncmp (szFileSysName, "NTFS", 4))
+ if (wcsncmp (szFileSysName, L"NTFS", 4))
{
// The previous filesystem type detection method failed (or it's not NTFS) -- try an alternative method
@@ -328,15 +327,15 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const char *devicePath,
return TRUE;
}
-BOOL CheckRequirementsForNonSysInPlaceDec (HWND hwndDlg, const char *devicePath, BOOL silent)
+BOOL CheckRequirementsForNonSysInPlaceDec (HWND hwndDlg, const wchar_t *devicePath, BOOL silent)
{
int partitionNumber = -1, driveNumber = -1;
/* ---------- Checks that do not require admin rights ----------- */
/* Volume type (must be a partition or a dynamic volume) */
- if ((sscanf (devicePath, "\\Device\\HarddiskVolume%d", &partitionNumber) != 1
- && sscanf (devicePath, "\\Device\\Harddisk%d\\Partition%d", &driveNumber, &partitionNumber) != 2)
+ if ((swscanf (devicePath, L"\\Device\\HarddiskVolume%d", &partitionNumber) != 1
+ && swscanf (devicePath, L"\\Device\\Harddisk%d\\Partition%d", &driveNumber, &partitionNumber) != 2)
|| partitionNumber == 0)
{
if (!silent)
@@ -375,8 +374,8 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
HANDLE dev = INVALID_HANDLE_VALUE;
DWORD dwError;
char *header;
- char dosDev[TC_MAX_PATH] = {0};
- char devName[MAX_PATH] = {0};
+ WCHAR dosDev[TC_MAX_PATH] = {0};
+ WCHAR devName[MAX_PATH] = {0};
int driveLetter = -1;
WCHAR deviceName[MAX_PATH];
uint64 dataAreaSize;
@@ -415,8 +414,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
dataAreaSize = GetVolumeDataAreaSize (volParams->hiddenVol, deviceSize);
- StringCbCopyA ((char *)deviceName, sizeof(deviceName), volParams->volumePath);
- ToUNICODE ((char *)deviceName, sizeof(deviceName));
+ StringCbCopyW (deviceName, sizeof(deviceName), volParams->volumePath);
driveLetter = GetDiskDeviceDriveLetter (deviceName);
@@ -665,7 +663,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
// Add the wizard to the system startup sequence if appropriate
if (!IsNonInstallMode ())
- ManageStartupSeqWiz (FALSE, "/prinplace");
+ ManageStartupSeqWiz (FALSE, L"/prinplace");
nStatus = ERR_SUCCESS;
@@ -714,8 +712,8 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
byte *wipeBuffer = NULL;
byte wipeRandChars [TC_WIPE_RAND_CHAR_COUNT];
byte wipeRandCharsUpdate [TC_WIPE_RAND_CHAR_COUNT];
- char dosDev[TC_MAX_PATH] = {0};
- char devName[MAX_PATH] = {0};
+ WCHAR dosDev[TC_MAX_PATH] = {0};
+ WCHAR devName[MAX_PATH] = {0};
WCHAR deviceName[MAX_PATH];
int nStatus = ERR_SUCCESS;
__int64 deviceSize;
@@ -727,7 +725,7 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
int sectorSize;
int i;
DWORD n;
- char *devicePath = volParams->volumePath;
+ WCHAR *devicePath = volParams->volumePath;
Password *password = volParams->password;
int pkcs5_prf = volParams->pkcs5;
int pim = volParams->pim;
@@ -781,8 +779,7 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
if (dev == INVALID_HANDLE_VALUE)
{
- StringCbCopyA ((char *)deviceName, sizeof(deviceName), devicePath);
- ToUNICODE ((char *)deviceName, sizeof(deviceName));
+ StringCbCopyW (deviceName, sizeof(deviceName), devicePath);
if (FakeDosNameForDevice (devicePath, dosDev, sizeof(dosDev),devName, sizeof(devName),FALSE) != 0)
{
@@ -1188,8 +1185,8 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
UINT64_STRUCT unitNo;
char *buf = NULL;
byte *tmpSectorBuf = NULL;
- char dosDev[TC_MAX_PATH] = {0};
- char devName[MAX_PATH] = {0};
+ WCHAR dosDev[TC_MAX_PATH] = {0};
+ WCHAR devName[MAX_PATH] = {0};
WCHAR deviceName[MAX_PATH];
int nStatus = ERR_SUCCESS;
__int64 deviceSize;
@@ -1201,7 +1198,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
int sectorSize;
int i;
DWORD n;
- char *devicePath = volParams->volumePath;
+ WCHAR *devicePath = volParams->volumePath;
Password *password = volParams->password;
HWND hwndDlg = volParams->hwndDlg;
int pkcs5_prf = volParams->pkcs5;
@@ -1247,8 +1244,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
}
- StringCbCopyA ((char *)deviceName, sizeof(deviceName), devicePath);
- ToUNICODE ((char *)deviceName, sizeof(deviceName));
+ StringCbCopyW (deviceName, sizeof(deviceName), devicePath);
if (FakeDosNameForDevice (devicePath, dosDev, sizeof(dosDev), devName, sizeof(devName), FALSE) != 0)
{
@@ -1355,7 +1351,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
// Add the wizard to the system startup sequence if appropriate
if (!IsNonInstallMode ())
- ManageStartupSeqWiz (FALSE, "/prinplace");
+ ManageStartupSeqWiz (FALSE, L"/prinplace");
}
@@ -1769,7 +1765,7 @@ closing_seq:
}
-static HANDLE OpenPartitionVolume (HWND hwndDlg, const char *devName,
+static HANDLE OpenPartitionVolume (HWND hwndDlg, const wchar_t *devName,
BOOL bExclusiveRequired,
BOOL bSharedRequired,
BOOL bSharedRequiresConfirmation,
@@ -2015,7 +2011,7 @@ BOOL SaveNonSysInPlaceEncSettings (int delta, WipeAlgorithmId newWipeAlgorithm,
}
else if (FileExists (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE)))
{
- remove (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE));
+ _wremove (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE));
}
}
@@ -2089,7 +2085,7 @@ closing_seq:
}
-static int OpenBackupHeader (HANDLE dev, const char *devicePath, Password *password, int pkcs5, int pim, PCRYPTO_INFO *retMasterCryptoInfo, CRYPTO_INFO *headerCryptoInfo, __int64 deviceSize)
+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;
diff --git a/src/Format/InPlace.h b/src/Format/InPlace.h
index 72e7ca2..049a883 100644
--- a/src/Format/InPlace.h
+++ b/src/Format/InPlace.h
@@ -29,8 +29,8 @@ enum nonsys_inplace_enc_status
NONSYS_INPLACE_ENC_STATUS_ERROR
};
-BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const char *devicePath, BOOL silent);
-BOOL CheckRequirementsForNonSysInPlaceDec (HWND hwndDlg, const char *devicePath, BOOL silent);
+BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const wchar_t *devicePath, BOOL silent);
+BOOL CheckRequirementsForNonSysInPlaceDec (HWND hwndDlg, const wchar_t *devicePath, BOOL silent);
int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, volatile HANDLE *outHandle, WipeAlgorithmId wipeAlgorithm);
int EncryptPartitionInPlaceResume (HANDLE dev, volatile FORMAT_VOL_PARAMETERS *volParams, WipeAlgorithmId wipeAlgorithm, volatile BOOL *bTryToCorrectReadErrors);
int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile BOOL *DiscardUnreadableEncryptedSectors);
@@ -38,13 +38,13 @@ void ShowInPlaceEncErrMsgWAltSteps (HWND hwndDlg, char *iniStrId, BOOL bErr);
void SetNonSysInplaceEncUIStatus (int nonSysInplaceEncStatus);
int FastVolumeHeaderUpdate (HANDLE dev, CRYPTO_INFO *headerCryptoInfo, CRYPTO_INFO *masterCryptoInfo, __int64 deviceSize);
-static HANDLE OpenPartitionVolume (HWND hwndDlg, const char *devName, BOOL bExclusiveRequired, BOOL bSharedRequired, BOOL bSharedRequiresConfirmation, BOOL bShowAlternativeSteps, BOOL bSilent);
+static HANDLE OpenPartitionVolume (HWND hwndDlg, const wchar_t *devName, BOOL bExclusiveRequired, BOOL bSharedRequired, BOOL bSharedRequiresConfirmation, BOOL bShowAlternativeSteps, BOOL bSilent);
static int DismountFileSystem (HWND hwndDlg, HANDLE dev, int driveLetter, BOOL bForcedAllowed, BOOL bForcedRequiresConfirmation, BOOL bSilent);
static int ConcealNTFS (HANDLE dev);
BOOL SaveNonSysInPlaceEncSettings (int delta, WipeAlgorithmId wipeAlgorithm, BOOL bDecrypting);
static void ExportProgressStats (__int64 bytesDone, __int64 totalSize);
int ZeroUnreadableSectors (HANDLE dev, LARGE_INTEGER startOffset, int64 size, int sectorSize, uint64 *zeroedSectorCount);
-static int OpenBackupHeader (HANDLE dev, const char *devicePath, Password *password, int pkcs5, int pim, PCRYPTO_INFO *retCryptoInfo, CRYPTO_INFO *headerCryptoInfo, __int64 deviceSize);
+static int OpenBackupHeader (HANDLE dev, const wchar_t *devicePath, Password *password, int pkcs5, int pim, PCRYPTO_INFO *retCryptoInfo, CRYPTO_INFO *headerCryptoInfo, __int64 deviceSize);
BOOL MoveClustersBeforeThreshold (HANDLE volumeHandle, PWSTR volumeDevicePath, int64 clusterThreshold);
#ifdef __cplusplus
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index 3fb1aca..e33b1ec 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
Binary files differ
diff --git a/src/Format/Tcformat.h b/src/Format/Tcformat.h
index 5bf42fc..778daeb 100644
--- a/src/Format/Tcformat.h
+++ b/src/Format/Tcformat.h
@@ -39,7 +39,7 @@ static void VerifySizeAndUpdate ( HWND hwndDlg , BOOL bUpdate );
static void __cdecl sysEncDriveAnalysisThread (void *hwndDlgArg);
static void __cdecl volTransformThreadFunction ( void *hwndDlg );
static void LoadPage ( HWND hwndDlg , int nPageNo );
-__int64 PrintFreeSpace ( HWND hwndTextBox , char *lpszDrive , PLARGE_INTEGER lDiskFree );
+__int64 PrintFreeSpace ( HWND hwndTextBox , wchar_t *lpszDrive , PLARGE_INTEGER lDiskFree );
void DisplaySizingErrorText ( HWND hwndTextBox );
void EnableDisableFileNext ( HWND hComboBox , HWND hMainButton );
BOOL QueryFreeSpace ( HWND hwndDlg , HWND hwndTextBox , BOOL display );
@@ -49,7 +49,7 @@ void HandleOldAssignedDriveLetter (void);
void AddCipher ( HWND hComboBox , char *lpszCipher , int nCipher );
BOOL CALLBACK PageDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
BOOL CALLBACK MainDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
-void ExtractCommandLine ( HWND hwndDlg , char *lpszCommandLine );
+void ExtractCommandLine ( HWND hwndDlg , wchar_t *lpszCommandLine );
void DisplayRandPool (HWND hwndDlg, HWND hPoolDisplay, BOOL bShow);
void DisplayPortionsOfKeys (HWND headerKeyHandle, HWND masterKeyHandle, char *headerKeyStr, char *masterKeyStr, BOOL hideKeys);
int DetermineMaxHiddenVolSize (HWND hwndDlg);
@@ -70,7 +70,7 @@ static void NonSysInplaceEncPause (void);
static void NonSysInplaceEncResume (void);
void ShowNonSysInPlaceEncUIStatus (void);
void UpdateNonSysInPlaceEncControls (void);
-int MountHiddenVolHost ( HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pim, BOOL bReadOnly );
+int MountHiddenVolHost ( HWND hwndDlg, wchar_t *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pim, BOOL bReadOnly );
int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *pnbrFreeClusters);
int ScanVolClusterBitmap ( HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int64 *nbrFreeClusters);
static void WipeStart (void);