mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-06-10 06:46:59 -05:00
Merge commit from fork
Hidden volumes are forced to quick format to avoid rewriting the hidden data area. Keep that behavior while skipping the file-container allocation shortcut that writes plaintext zero sectors at 128 MiB intervals. The allocation shortcut remains enabled for non-hidden file containers; hidden containers now use only the encrypted formatter write path for sectors that are written.
This commit is contained in:
+3
-2
@@ -271,6 +271,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
|
|||||||
volatile FORMAT_VOL_PARAMETERS* volParams = (volatile FORMAT_VOL_PARAMETERS*)volParamsArg;
|
volatile FORMAT_VOL_PARAMETERS* volParams = (volatile FORMAT_VOL_PARAMETERS*)volParamsArg;
|
||||||
BOOL quickFormat = volParams->quickFormat;
|
BOOL quickFormat = volParams->quickFormat;
|
||||||
BOOL bDevice = volParams->bDevice;
|
BOOL bDevice = volParams->bDevice;
|
||||||
|
BOOL hiddenVol = volParams->hiddenVol;
|
||||||
|
|
||||||
LARGE_INTEGER startOffset;
|
LARGE_INTEGER startOffset;
|
||||||
LARGE_INTEGER newOffset;
|
LARGE_INTEGER newOffset;
|
||||||
@@ -480,12 +481,12 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
|
|||||||
burn (&tmpCI, sizeof (tmpCI));
|
burn (&tmpCI, sizeof (tmpCI));
|
||||||
VirtualUnlock (&tmpCI, sizeof (tmpCI));
|
VirtualUnlock (&tmpCI, sizeof (tmpCI));
|
||||||
}
|
}
|
||||||
else if (!bDevice)
|
else if (!bDevice && !hiddenVol)
|
||||||
{
|
{
|
||||||
if (!FlushFormatWriteBuffer (dev, write_buf, &write_buf_cnt, &nSecNo, cryptoInfo))
|
if (!FlushFormatWriteBuffer (dev, write_buf, &write_buf_cnt, &nSecNo, cryptoInfo))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
// Quick format: write a zeroed sector every 128 MiB, leaving other sectors untouched
|
// Quick format of a non-hidden file container: write a zeroed sector every 128 MiB, leaving other sectors untouched
|
||||||
// This helps users visualize the progress of actual file creation while forcing Windows
|
// This helps users visualize the progress of actual file creation while forcing Windows
|
||||||
// to allocate the disk space of each 128 MiB chunk immediately, otherwise, Windows
|
// to allocate the disk space of each 128 MiB chunk immediately, otherwise, Windows
|
||||||
// would delay the allocation until we write the backup header at the end of the volume which
|
// would delay the allocation until we write the backup header at the end of the volume which
|
||||||
|
|||||||
+3
-2
@@ -914,6 +914,7 @@ int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, unsigned __int64 num
|
|||||||
CRYPTOPP_ALIGN_DATA(16) char originalK2[MASTER_KEYDATA_SIZE];
|
CRYPTOPP_ALIGN_DATA(16) char originalK2[MASTER_KEYDATA_SIZE];
|
||||||
BOOL quickFormat = volParams->quickFormat;
|
BOOL quickFormat = volParams->quickFormat;
|
||||||
BOOL bDevice = volParams->bDevice;
|
BOOL bDevice = volParams->bDevice;
|
||||||
|
BOOL hiddenVol = volParams->hiddenVol;
|
||||||
|
|
||||||
LARGE_INTEGER startOffset;
|
LARGE_INTEGER startOffset;
|
||||||
LARGE_INTEGER newOffset;
|
LARGE_INTEGER newOffset;
|
||||||
@@ -999,9 +1000,9 @@ int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, unsigned __int64 num
|
|||||||
if (!FlushFormatWriteBuffer (dev, write_buf, &write_buf_cnt, &nSecNo, cryptoInfo))
|
if (!FlushFormatWriteBuffer (dev, write_buf, &write_buf_cnt, &nSecNo, cryptoInfo))
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
else if (!bDevice)
|
else if (!bDevice && !hiddenVol)
|
||||||
{
|
{
|
||||||
// Quick format: write a zeroed sector every 128 MiB, leaving other sectors untouched
|
// Quick format of a non-hidden file container: write a zeroed sector every 128 MiB, leaving other sectors untouched
|
||||||
// This helps users visualize the progress of actual file creation while forcing Windows
|
// This helps users visualize the progress of actual file creation while forcing Windows
|
||||||
// to allocate the disk space of each 128 MiB chunk immediately, otherwise, Windows
|
// to allocate the disk space of each 128 MiB chunk immediately, otherwise, Windows
|
||||||
// would delay the allocation until we write the backup header at the end of the volume which
|
// would delay the allocation until we write the backup header at the end of the volume which
|
||||||
|
|||||||
Reference in New Issue
Block a user