From dcb8390bb250780a4b8bb5fd8f91bc8e53e711bc Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Tue, 26 Jan 2016 23:22:59 +0100 Subject: Windows/Linux: Implement exFAT support. --- src/Common/Format.c | 32 ++++++++++++++++++----- src/Common/Format.h | 2 ++ src/Common/Language.xml | 23 ++++++++-------- src/Common/Volumes.h | 2 ++ src/Core/VolumeCreator.h | 1 + src/ExpandVolume/DlgExpandVolume.cpp | 7 ++++- src/ExpandVolume/ExpandVolume.c | Bin 24775 -> 49914 bytes src/ExpandVolume/ExpandVolume.h | 3 ++- src/Format/FormatCom.cpp | 22 ++++++++++++++++ src/Format/FormatCom.h | 1 + src/Format/FormatCom.idl | 3 ++- src/Format/Tcformat.c | Bin 634106 -> 636272 bytes src/Main/CommandLineInterface.cpp | 2 ++ src/Main/Forms/VolumeCreationWizard.cpp | 1 + src/Main/Forms/VolumeFormatOptionsWizardPage.cpp | 3 +++ src/Main/TextUserInterface.cpp | 2 ++ src/Setup/ComSetup.cpp | 4 ++- 17 files changed, 87 insertions(+), 21 deletions(-) diff --git a/src/Common/Format.c b/src/Common/Format.c index 85fdbe65..a3200bb4 100644 --- a/src/Common/Format.c +++ b/src/Common/Format.c @@ -474,6 +474,7 @@ begin_format: { case FILESYS_NONE: case FILESYS_NTFS: + case FILESYS_EXFAT: if (volParams->bDevice && !StartFormatWriteThread()) { @@ -572,7 +573,7 @@ begin_format: } #ifndef DEBUG - if (volParams->quickFormat && volParams->fileSystem != FILESYS_NTFS) + if (volParams->quickFormat && volParams->fileSystem != FILESYS_NTFS && volParams->fileSystem != FILESYS_EXFAT) Sleep (500); // User-friendly GUI #endif @@ -606,12 +607,13 @@ error: goto fv_end; } - if (volParams->fileSystem == FILESYS_NTFS) + if (volParams->fileSystem == FILESYS_NTFS || volParams->fileSystem == FILESYS_EXFAT) { // Quick-format volume as NTFS int driveNo = GetLastAvailableDrive (); MountOptions mountOptions; int retCode; + int fsType = (volParams->fileSystem == FILESYS_EXFAT)? FILESYS_EXFAT: FILESYS_NTFS; ZeroMemory (&mountOptions, sizeof (mountOptions)); @@ -646,9 +648,9 @@ error: } if (!Silent && !IsAdmin () && IsUacSupported ()) - retCode = UacFormatNtfs (volParams->hwndDlg, driveNo, volParams->clusterSize); + retCode = UacFormatFs (volParams->hwndDlg, driveNo, volParams->clusterSize, fsType); else - retCode = FormatNtfs (driveNo, volParams->clusterSize); + retCode = FormatFs (driveNo, volParams->clusterSize, fsType); if (retCode != TRUE) { @@ -860,13 +862,27 @@ BOOLEAN __stdcall FormatExCallback (int command, DWORD subCommand, PVOID paramet return (FormatExError? FALSE : TRUE); } -BOOL FormatNtfs (int driveNo, int clusterSize) +BOOL FormatFs (int driveNo, int clusterSize, int fsType) { wchar_t dllPath[MAX_PATH] = {0}; WCHAR dir[8] = { (WCHAR) driveNo + L'A', 0 }; PFORMATEX FormatEx; HMODULE hModule; int i; + WCHAR szFsFormat[16]; + WCHAR szLabel[2] = {0}; + switch (fsType) + { + case FILESYS_NTFS: + StringCbCopyW (szFsFormat, sizeof (szFsFormat),L"NTFS"); + break; + case FILESYS_EXFAT: + StringCbCopyW (szFsFormat, sizeof (szFsFormat),L"EXFAT"); + break; + default: + return FALSE; + } + if (GetSystemDirectory (dllPath, MAX_PATH)) { @@ -895,7 +911,7 @@ BOOL FormatNtfs (int driveNo, int clusterSize) for (i = 0; i < 50 && FormatExError; i++) { FormatExError = FALSE; - FormatEx (dir, FMIFS_HARDDISK, L"NTFS", L"", TRUE, clusterSize * FormatSectorSize, FormatExCallback); + FormatEx (dir, FMIFS_HARDDISK, szFsFormat, szLabel, TRUE, clusterSize * FormatSectorSize, FormatExCallback); } // The device may be referenced for some time after FormatEx() returns @@ -905,6 +921,10 @@ BOOL FormatNtfs (int driveNo, int clusterSize) return FormatExError? FALSE : TRUE; } +BOOL FormatNtfs (int driveNo, int clusterSize) +{ + return FormatFs (driveNo, clusterSize, FILESYS_NTFS); +} BOOL WriteSector (void *dev, char *sector, char *write_buf, int *write_buf_cnt, diff --git a/src/Common/Format.h b/src/Common/Format.h index 72d1c291..3aa764b0 100644 --- a/src/Common/Format.h +++ b/src/Common/Format.h @@ -74,6 +74,7 @@ extern int FormatWriteBufferSize; int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams); BOOL FormatNtfs (int driveNo, int clusterSize); +BOOL FormatFs (int driveNo, int clusterSize, int fsType); uint64 GetVolumeDataAreaSize (BOOL hiddenVolume, uint64 volumeSize); int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, __int64 num_sectors, void *dev, PCRYPTO_INFO cryptoInfo, BOOL quickFormat); BOOL WriteSector ( void *dev , char *sector , char *write_buf , int *write_buf_cnt , __int64 *nSecNo , PCRYPTO_INFO cryptoInfo ); @@ -84,6 +85,7 @@ static void StopFormatWriteThread (); #define FILESYS_NONE 0 #define FILESYS_FAT 1 #define FILESYS_NTFS 2 +#define FILESYS_EXFAT 3 #ifdef __cplusplus } diff --git a/src/Common/Language.xml b/src/Common/Language.xml index 16821359..184bdd5c 100644 --- a/src/Common/Language.xml +++ b/src/Common/Language.xml @@ -397,7 +397,7 @@ In order to load the VeraCrypt driver, you need to be logged into an account with administrator privileges. Please note that in order to encrypt, decrypt or format a partition/device you need to be logged into an account with administrator privileges.\n\nThis does not apply to file-hosted volumes. In order to create a hidden volume you need to be logged into an account with administrator privileges.\n\nContinue? - Please note that in order to format the volume as NTFS you need to be logged into an account with administrator privileges.\n\nWithout administrator privileges, you can format the volume as FAT. + Please note that in order to format the volume as NTFS/exFAT you need to be logged into an account with administrator privileges.\n\nWithout administrator privileges, you can format the volume as FAT. FIPS-approved cipher (Rijndael, published in 1998) that may be used by U.S. government departments and agencies to protect classified information up to the Top Secret level. 256-bit key, 128-bit block, 14 rounds (AES-256). Mode of operation is XTS. Volume is already mounted. CAUTION: At least one encryption or hash algorithm failed the built-in automatic self-tests!\n\nVeraCrypt installation may be corrupted. @@ -488,7 +488,7 @@ Large Files Do you intend to store files larger than 4 GB in this VeraCrypt volume? Depending on your choice above, VeraCrypt will choose a suitable default file system for the VeraCrypt volume (you will be able to select a file system in the next step). - As you are creating an outer volume, you should consider choosing 'No'. If you choose 'Yes', the default filesystem will be NTFS, which is not as suitable for outer volumes as FAT (for example, the maximum possible size of the hidden volume will be significantly greater if the outer volume is formatted as FAT). Normally, FAT is the default for both hidden and normal volumes (so FAT volumes are not suspicious). However, if the user indicates intent to store files larger than 4 GB (which the FAT file system does not allow), then FAT is not the default. + As you are creating an outer volume, you should consider choosing 'No'. If you choose 'Yes', the default filesystem will be NTFS, which is not as suitable for outer volumes as FAT/exFAT (for example, the maximum possible size of the hidden volume will be significantly greater if the outer volume is formatted as FAT/exFAT). Normally, FAT is the default for both hidden and normal volumes (so FAT volumes are not suspicious). However, if the user indicates intent to store files larger than 4 GB (which the FAT file system does not allow), then FAT is not the default. Are you sure you want to choose 'Yes'? Volume Creation Mode This is the fastest way to create a partition-hosted or device-hosted VeraCrypt volume (in-place encryption, which is the other option, is slower because content of each sector has to be first read, encrypted, and then written). Any data currently stored on the selected partition/device will be lost (the data will NOT be encrypted; it will be overwritten with random data). If you want to encrypt existing data on a partition, choose the other option. @@ -543,8 +543,8 @@ The hidden volume is now protected against damage until the outer volume is dismounted.\n\nWARNING: If any data is attempted to be saved to the hidden volume area, VeraCrypt will start write-protecting the entire volume (both the outer and the hidden part) until it is dismounted. This may cause filesystem corruption on the outer volume, which (if repeated) might adversely affect plausible deniability of the hidden volume. Therefore, you should make every effort to avoid writing to the hidden volume area. Any data being saved to the hidden volume area will not be saved and will be lost. Windows may report this as a write error ("Delayed Write Failed" or "The parameter is incorrect"). Each of the hidden volumes within the newly mounted volumes is now protected against damage until dismounted.\n\nWARNING: If any data is attempted to be saved to protected hidden volume area of any of these volumes, VeraCrypt will start write-protecting the entire volume (both the outer and the hidden part) until it is dismounted. This may cause filesystem corruption on the outer volume, which (if repeated) might adversely affect plausible deniability of the hidden volume. Therefore, you should make every effort to avoid writing to the hidden volume area. Any data being saved to protected hidden volume areas will not be saved and will be lost. Windows may report this as a write error ("Delayed Write Failed" or "The parameter is incorrect"). WARNING: Data were attempted to be saved to the hidden volume area of the volume mounted as %c:! VeraCrypt prevented these data from being saved in order to protect the hidden volume. This may have caused filesystem corruption on the outer volume and Windows may have reported a write error ("Delayed Write Failed" or "The parameter is incorrect"). The entire volume (both the outer and the hidden part) will be write-protected until it is dismounted. If this is not the first time VeraCrypt has prevented data from being saved to the hidden volume area of this volume, plausible deniability of this hidden volume might be adversely affected (due to possible unusual correlated inconsistencies within the outer volume file system). Therefore, you should consider creating a new VeraCrypt volume (with Quick Format disabled) and moving files from this volume to the new volume; this volume should be securely erased (both the outer and the hidden part). We strongly recommend that you restart the operating system now. - You have indicated intent to store files larger than 4 GB on the volume. This requires the volume to be formatted as NTFS, which, however, will not be possible. - Please note that when a hidden operating system is running, non-hidden VeraCrypt volumes cannot be formatted as NTFS. The reason is that the volume would need to be temporarily mounted without write protection in order to allow the operating system to format it as NTFS (whereas formatting as FAT is performed by VeraCrypt, not by the operating system, and without mounting the volume). For further technical details, see below. You can create a non-hidden NTFS volume from within the decoy operating system. + You have indicated intent to store files larger than 4 GB on the volume. This requires the volume to be formatted as NTFS/exFAT, which, however, will not be possible. + Please note that when a hidden operating system is running, non-hidden VeraCrypt volumes cannot be formatted as NTFS/exFAT. The reason is that the volume would need to be temporarily mounted without write protection in order to allow the operating system to format it as NTFS (whereas formatting as FAT is performed by VeraCrypt, not by the operating system, and without mounting the volume). For further technical details, see below. You can create a non-hidden NTFS/exFAT volume from within the decoy operating system. For security reasons, when a hidden operating system is running, hidden volumes can be created only in the 'direct' mode (because outer volumes must always be mounted as read-only). To create a hidden volume securely, follow these steps:\n\n1) Boot the decoy system.\n\n2) Create a normal VeraCrypt volume and, to this volume, copy some sensitive-looking files that you actually do NOT want to hide (the volume will become the outer volume).\n\n3) Boot the hidden system and start the VeraCrypt Volume Creation Wizard. If the volume is file-hosted, move it to the system partition or to another hidden volume (otherwise, the newly created hidden volume would be mounted as read-only and could not be formatted). Follow the instructions in the wizard so as to select the 'direct' hidden volume creation mode.\n\n4) In the wizard, select the volume you created in step 2 and then follow the instructions to create a hidden volume within it. For security reasons, when a hidden operating system is running, local unencrypted filesystems and non-hidden VeraCrypt volumes are mounted as read-only (no data can be written to such filesystems or VeraCrypt volumes).\n\nData is allowed to be written to any filesystem that resides within a hidden VeraCrypt volume (provided that the hidden volume is not located in a container stored on an unencrypted filesystem or on any other read-only filesystem). There are three main reasons why such countermeasures have been implemented:\n\n- It enables the creation of a secure platform for mounting of hidden VeraCrypt volumes. Note that we officially recommend that hidden volumes are mounted only when a hidden operating system is running. (For more information, see the subsection 'Security Requirements and Precautions Pertaining to Hidden Volumes' in the documentation.)\n\n- In some cases, it is possible to determine that, at a certain time, a particular filesystem was not mounted under (or that a particular file on the filesystem was not saved or accessed from within) a particular instance of an operating system (e.g. by analyzing and comparing filesystem journals, file timestamps, application logs, error logs, etc). This might indicate that a hidden operating system is installed on the computer. The countermeasures prevent these issues.\n\n- It prevents data corruption and allows safe hibernation. When Windows resumes from hibernation, it assumes that all mounted filesystems are in the same state as when the system entered hibernation. VeraCrypt ensures this by write-protecting any filesystem accessible both from within the decoy and hidden systems. Without such protection, the filesystem could become corrupted when mounted by one system while the other system is hibernated. @@ -675,7 +675,7 @@ Select a directory where to store the keyfiles. The current container file was selected as a keyfile. It will be skipped. Designed by Ross Anderson, Eli Biham, and Lars Knudsen. Published in 1998. 256-bit key, 128-bit block. Mode of operation is XTS. Serpent was one of the AES finalists. - Please specify the size of the container you want to create.\n\nIf you create a dynamic (sparse-file) container, this parameter will specify its maximum possible size.\n\nNote that the minimum possible size of a FAT volume is 292 KB. The minimum possible size of an NTFS volume is 3792 KB. + Please specify the size of the container you want to create.\n\nIf you create a dynamic (sparse-file) container, this parameter will specify its maximum possible size.\n\nNote that the minimum possible size of a FAT volume is 292 KB. The minimum possible size of an exFAT volume is 424 KB. The minimum possible size of an NTFS volume is 3792 KB. Please specify the size of the outer volume to be created (you will first create the outer volume and then a hidden volume within it). The minimum possible size of a volume within which a hidden volume is intended to be created is 340 KB. Please specify the size of the hidden volume to create. The minimum possible size of a hidden volume is 40 KB (or 3664 KB if it is formatted as NTFS). The maximum possible size you can specify for the hidden volume is displayed above. Outer Volume Size @@ -734,11 +734,11 @@ All Files VeraCrypt Volumes Library Modules - NTFS formatting cannot continue. + NTFS/exFAT formatting cannot continue. Cannot mount volume. Cannot dismount volume. - Windows failed to format the volume as NTFS.\n\nPlease select a different type of file system (if possible) and try again. Alternatively, you could leave the volume unformatted (select 'None' as the filesystem), exit this wizard, mount the volume, and then use either a system or a third-party tool to format the mounted volume (the volume will remain encrypted). - Windows failed to format the volume as NTFS.\n\nDo you want to format the volume as FAT instead? + Windows failed to format the volume as NTFS/exFAT.\n\nPlease select a different type of file system (if possible) and try again. Alternatively, you could leave the volume unformatted (select 'None' as the filesystem), exit this wizard, mount the volume, and then use either a system or a third-party tool to format the mounted volume (the volume will remain encrypted). + Windows failed to format the volume as NTFS/exFAT.\n\nDo you want to format the volume as FAT instead? Default partition PARTITION @@ -752,10 +752,10 @@ The selected cluster size is too small for this volume size. A greater cluster size will be used instead. Error: Cannot get volume size!\n\nMake sure the selected volume is not being used by the system or an application. Hidden volumes must not be created within dynamic (sparse file) containers. To achieve plausible deniability, the hidden volume needs to be created within a non-dynamic container. - The VeraCrypt Volume Creation Wizard can create a hidden volume only within a FAT or NTFS volume. + The VeraCrypt Volume Creation Wizard can create a hidden volume only within a FAT/exFAT or NTFS volume. Under Windows 2000, the VeraCrypt Volume Creation Wizard can create a hidden volume only within a FAT volume. - Note: The FAT file system is more suitable for outer volumes than the NTFS file system (for example, the maximum possible size of the hidden volume would very likely have been significantly greater if the outer volume had been formatted as FAT). - Note that the FAT file system is more suitable for outer volumes than the NTFS file system. For example, the maximum possible size of the hidden volume will very likely be significantly greater if the outer volume is formatted as FAT (the reason is that the NTFS file system always stores internal data exactly in the middle of the volume and, therefore, the hidden volume can reside only in the second half of the outer volume).\n\nAre you sure you want to format the outer volume as NTFS? + Note: The FAT/exFAT file system is more suitable for outer volumes than the NTFS file system (for example, the maximum possible size of the hidden volume would very likely have been significantly greater if the outer volume had been formatted as FAT/exFAT). + Note that the FAT/exFAT file system is more suitable for outer volumes than the NTFS file system. For example, the maximum possible size of the hidden volume will very likely be significantly greater if the outer volume is formatted as FAT/exFAT (the reason is that the NTFS file system always stores internal data exactly in the middle of the volume and, therefore, the hidden volume can reside only in the second half of the outer volume).\n\nAre you sure you want to format the outer volume as NTFS? Do you want to format the volume as FAT instead? Note: This volume cannot be formatted as FAT, because it exceeds the maximum volume size supported by the FAT32 filesystem for the applicable sector size (2 TB for 512-byte sectors and 16 TB for 4096-byte sectors). Error: The partition for the hidden operating system (i.e. the first partition behind the system partition) must be at least 5% larger than the system partition (the system partition is the one where the currently running operating system is installed). @@ -1385,6 +1385,7 @@ TB/s PB/s + The volume file size specified in the command line is incompatible with selected exFAT filesystem. diff --git a/src/Common/Volumes.h b/src/Common/Volumes.h index 2216d2b4..b0f295f3 100644 --- a/src/Common/Volumes.h +++ b/src/Common/Volumes.h @@ -75,6 +75,8 @@ extern "C" { #define TC_MIN_NTFS_FS_SIZE (884 * TC_MAX_VOLUME_SECTOR_SIZE) #define TC_MAX_NTFS_FS_SIZE (128LL * BYTES_PER_TB) // NTFS volume can theoretically be up to 16 exabytes, but Windows XP and 2003 limit the size to that addressable with 32-bit clusters, i.e. max size is 128 TB (if 64-KB clusters are used). #define TC_MAX_FAT_CLUSTER_SIZE (256 * BYTES_PER_KB) // Windows XP/Vista may crash when writing to a filesystem using clusters larger than 256 KB +#define TC_MIN_EXFAT_FS_SIZE (42 * TC_MAX_VOLUME_SECTOR_SIZE) +#define TC_MAX_EXFAT_FS_SIZE (128LL * BYTES_PER_PB) // Volume size limits #define TC_MIN_VOLUME_SIZE (TC_TOTAL_VOLUME_HEADERS_SIZE + TC_MIN_FAT_FS_SIZE) diff --git a/src/Core/VolumeCreator.h b/src/Core/VolumeCreator.h index 3e1fa55f..2c9fff3a 100644 --- a/src/Core/VolumeCreator.h +++ b/src/Core/VolumeCreator.h @@ -39,6 +39,7 @@ namespace VeraCrypt Unknown = 0, None, FAT, + exFAT, NTFS, Ext2, Ext3, diff --git a/src/ExpandVolume/DlgExpandVolume.cpp b/src/ExpandVolume/DlgExpandVolume.cpp index 4552056a..a54252cd 100644 --- a/src/ExpandVolume/DlgExpandVolume.cpp +++ b/src/ExpandVolume/DlgExpandVolume.cpp @@ -50,7 +50,7 @@ #define TIMER_INTERVAL_RANDVIEW 50 // see definition of enum EV_FileSystem -const wchar_t * szFileSystemStr[3] = {L"RAW",L"FAT",L"NTFS"}; +const wchar_t * szFileSystemStr[4] = {L"RAW",L"FAT",L"NTFS",L"EXFAT"}; // prototypes for internal functions BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); @@ -628,6 +628,11 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume) lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) goto ret; break; + case EV_FS_TYPE_EXFAT: + if (MessageBoxW (hwndDlg,L"Warning: The VeraCrypt volume contains an exFAT file system!\n\nOnly the VeraCrypt volume itself will be expanded, but not the file system.\n\nDo you want to continue?", + lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) + goto ret; + break; default: if (MessageBoxW (hwndDlg,L"Warning: The VeraCrypt volume contains an unknown or no file system!\n\nOnly the VeraCrypt volume itself will be expanded, the file system remains unchanged.\n\nDo you want to continue?", lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDNO) diff --git a/src/ExpandVolume/ExpandVolume.c b/src/ExpandVolume/ExpandVolume.c index f49a9d96..d4aa763a 100644 Binary files a/src/ExpandVolume/ExpandVolume.c and b/src/ExpandVolume/ExpandVolume.c differ diff --git a/src/ExpandVolume/ExpandVolume.h b/src/ExpandVolume/ExpandVolume.h index 21c1e27d..87f0e42d 100644 --- a/src/ExpandVolume/ExpandVolume.h +++ b/src/ExpandVolume/ExpandVolume.h @@ -25,9 +25,10 @@ enum EV_FileSystem EV_FS_TYPE_RAW = 0, EV_FS_TYPE_FAT = 1, EV_FS_TYPE_NTFS = 2, + EV_FS_TYPE_EXFAT = 3, }; -extern const wchar_t * szFileSystemStr[3]; +extern const wchar_t * szFileSystemStr[4]; typedef struct { diff --git a/src/Format/FormatCom.cpp b/src/Format/FormatCom.cpp index d52b21df..2dd5fa79 100644 --- a/src/Format/FormatCom.cpp +++ b/src/Format/FormatCom.cpp @@ -132,6 +132,11 @@ public: return BaseCom::WriteLocalMachineRegistryDwordValue (keyPath, valueName, value); } + virtual BOOL STDMETHODCALLTYPE FormatFs (int driveNo, int clusterSize, int fsType) + { + return ::FormatFs (driveNo, clusterSize, fsType); + } + protected: DWORD MessageThreadId; LONG RefCount; @@ -207,6 +212,23 @@ extern "C" int UacFormatNtfs (HWND hWnd, int driveNo, int clusterSize) return r; } +extern "C" int UacFormatFs (HWND hWnd, int driveNo, int clusterSize, int fsType) +{ + CComPtr tc; + int r; + + CoInitialize (NULL); + + if (ComGetInstance (hWnd, &tc)) + r = tc->FormatFs (driveNo, clusterSize, fsType); + else + r = 0; + + CoUninitialize (); + + return r; +} + extern "C" int UacAnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *nbrFreeClusters) { diff --git a/src/Format/FormatCom.h b/src/Format/FormatCom.h index 4ae0c3af..e79cd9cc 100644 --- a/src/Format/FormatCom.h +++ b/src/Format/FormatCom.h @@ -25,6 +25,7 @@ extern "C" { 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); diff --git a/src/Format/FormatCom.idl b/src/Format/FormatCom.idl index 39805cf9..5579d28d 100644 --- a/src/Format/FormatCom.idl +++ b/src/Format/FormatCom.idl @@ -16,7 +16,7 @@ import "..\Common\Password.h"; [ uuid(56327DDA-F1A7-4e13-B128-520D129BDEF6), helpstring("VeraCrypt Format UAC Support Library"), - version(2.4) // Update ComSetup.cpp when changing version number + version(2.5) // Update ComSetup.cpp when changing version number ] library TrueCryptFormatCom { @@ -39,6 +39,7 @@ library TrueCryptFormatCom DWORD RegisterSystemFavoritesService (BOOL registerService); DWORD SetDriverServiceStartType (DWORD startType); DWORD WriteLocalMachineRegistryDwordValue (BSTR keyPath, BSTR valueName, DWORD value); + BOOL FormatFs (int driveNo, int clusterSize, int fsType); }; [ diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 2df69aeb..a159ca73 100644 Binary files a/src/Format/Tcformat.c and b/src/Format/Tcformat.c differ diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp index f0d1f257..281b1aec 100644 --- a/src/Main/CommandLineInterface.cpp +++ b/src/Main/CommandLineInterface.cpp @@ -306,6 +306,8 @@ namespace VeraCrypt ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext4; else if (str.IsSameAs (L"NTFS", false)) ArgFilesystem = VolumeCreationOptions::FilesystemType::NTFS; + else if (str.IsSameAs (L"exFAT", false)) + ArgFilesystem = VolumeCreationOptions::FilesystemType::exFAT; #elif defined (TC_MACOSX) else if ( str.IsSameAs (L"HFS", false) || str.IsSameAs (L"HFS+", false) diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp index 5605920d..4b63ce2f 100755 --- a/src/Main/Forms/VolumeCreationWizard.cpp +++ b/src/Main/Forms/VolumeCreationWizard.cpp @@ -451,6 +451,7 @@ namespace VeraCrypt case VolumeCreationOptions::FilesystemType::MacOsExt: fsFormatter = "newfs_hfs"; break; case VolumeCreationOptions::FilesystemType::UFS: fsFormatter = "newfs" ; break; case VolumeCreationOptions::FilesystemType::NTFS: fsFormatter = "mkfs.ntfs" ; break; + case VolumeCreationOptions::FilesystemType::exFAT: fsFormatter = "mkfs.exfat" ; break; default: break; } diff --git a/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp b/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp index 6d32dd59..6e0aa432 100644 --- a/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp +++ b/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp @@ -30,11 +30,13 @@ namespace VeraCrypt #ifdef TC_WINDOWS FilesystemTypeChoice->Append (L"NTFS", (void *) VolumeCreationOptions::FilesystemType::NTFS); + FilesystemTypeChoice->Append (L"exFAT", (void *) VolumeCreationOptions::FilesystemType::exFAT); #elif defined (TC_LINUX) FilesystemTypeChoice->Append (L"Linux Ext2", (void *) VolumeCreationOptions::FilesystemType::Ext2); FilesystemTypeChoice->Append (L"Linux Ext3", (void *) VolumeCreationOptions::FilesystemType::Ext3); FilesystemTypeChoice->Append (L"Linux Ext4", (void *) VolumeCreationOptions::FilesystemType::Ext4); FilesystemTypeChoice->Append (L"NTFS", (void *) VolumeCreationOptions::FilesystemType::NTFS); + FilesystemTypeChoice->Append (L"exFAT", (void *) VolumeCreationOptions::FilesystemType::exFAT); #elif defined (TC_MACOSX) FilesystemTypeChoice->Append (L"Mac OS Extended", (void *) VolumeCreationOptions::FilesystemType::MacOsExt); #elif defined (TC_FREEBSD) || defined (TC_SOLARIS) @@ -72,6 +74,7 @@ namespace VeraCrypt { case VolumeCreationOptions::FilesystemType::None: FilesystemTypeChoice->SetStringSelection (LangString["NONE"]); break; case VolumeCreationOptions::FilesystemType::FAT: FilesystemTypeChoice->SetStringSelection (L"FAT"); break; + case VolumeCreationOptions::FilesystemType::exFAT: FilesystemTypeChoice->SetStringSelection (L"exFAT"); break; case VolumeCreationOptions::FilesystemType::NTFS: FilesystemTypeChoice->SetStringSelection (L"NTFS"); break; case VolumeCreationOptions::FilesystemType::Ext2: FilesystemTypeChoice->SetStringSelection (L"Linux Ext2"); break; case VolumeCreationOptions::FilesystemType::Ext3: FilesystemTypeChoice->SetStringSelection (L"Linux Ext3"); break; diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp index fb654f3a..d0d25041 100644 --- a/src/Main/TextUserInterface.cpp +++ b/src/Main/TextUserInterface.cpp @@ -737,6 +737,7 @@ namespace VeraCrypt ShowInfo (L" 4) Linux Ext3"); filesystems.push_back (VolumeCreationOptions::FilesystemType::Ext3); ShowInfo (L" 5) Linux Ext4"); filesystems.push_back (VolumeCreationOptions::FilesystemType::Ext4); ShowInfo (L" 6) NTFS"); filesystems.push_back (VolumeCreationOptions::FilesystemType::NTFS); + ShowInfo (L" 7) exFAT"); filesystems.push_back (VolumeCreationOptions::FilesystemType::exFAT); #elif defined (TC_MACOSX) ShowInfo (L" 3) Mac OS Extended"); filesystems.push_back (VolumeCreationOptions::FilesystemType::MacOsExt); #elif defined (TC_FREEBSD) || defined (TC_SOLARIS) @@ -832,6 +833,7 @@ namespace VeraCrypt case VolumeCreationOptions::FilesystemType::MacOsExt: fsFormatter = "newfs_hfs"; break; case VolumeCreationOptions::FilesystemType::UFS: fsFormatter = "newfs" ; break; case VolumeCreationOptions::FilesystemType::NTFS: fsFormatter = "mkfs.ntfs"; break; + case VolumeCreationOptions::FilesystemType::exFAT: fsFormatter = "mkfs.exfat"; break; default: throw ParameterIncorrect (SRC_POS); } diff --git a/src/Setup/ComSetup.cpp b/src/Setup/ComSetup.cpp index 9751368c..5e45f8e3 100644 --- a/src/Setup/ComSetup.cpp +++ b/src/Setup/ComSetup.cpp @@ -14,7 +14,7 @@ #define TC_MAIN_COM_VERSION_MINOR 7 #define TC_FORMAT_COM_VERSION_MAJOR 2 -#define TC_FORMAT_COM_VERSION_MINOR 4 +#define TC_FORMAT_COM_VERSION_MINOR 5 #include #include @@ -42,6 +42,7 @@ extern "C" BOOL RegisterComServers (wchar_t *modulePath) UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-3, 0, SYS_WIN32); UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-2, 0, SYS_WIN32); UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-1, 0, SYS_WIN32); + UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-1, 0, SYS_WIN32); wchar_t setupModule[MAX_PATH]; GetModuleFileNameW (NULL, setupModule, sizeof (setupModule) / sizeof (setupModule[0])); @@ -80,6 +81,7 @@ extern "C" BOOL UnregisterComServers (wchar_t *modulePath) UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-3, 0, SYS_WIN32); UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-2, 0, SYS_WIN32); UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-1, 0, SYS_WIN32); + UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-1, 0, SYS_WIN32); wchar_t module[1024]; CRegObject ro; -- cgit v1.2.3