VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Format
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2017-05-27 22:02:10 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-05-27 22:04:31 (GMT)
commit5651d505f5afab7669870f95a0ac85a63c1be374 (patch)
treef8b70206f8c52c62c16ed447ea019652afe8fc0f /src/Format
parentbc8e6fa5bd9e8db028fd15f63e681a86059ef933 (diff)
downloadVeraCrypt-5651d505f5afab7669870f95a0ac85a63c1be374.zip
VeraCrypt-5651d505f5afab7669870f95a0ac85a63c1be374.tar.gz
Windows: Only offer valid cluster sizes when ReFS is selected in the volume format wizard.
Diffstat (limited to 'src/Format')
-rw-r--r--src/Format/Tcformat.c60
1 files changed, 37 insertions, 23 deletions
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index 3f52fd3..900b023 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -3638,6 +3638,36 @@ void DisableIfGpt(HWND control)
}
}
+static void UpdateClusterSizeList (HWND hwndDlg, int fsType)
+{
+ SendMessage (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), CB_RESETCONTENT, 0, 0);
+ AddComboPair (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), GetString ("DEFAULT"), 0);
+
+ for (int i = 1; i <= 128; i *= 2)
+ {
+ wstringstream s;
+ DWORD size = GetFormatSectorSize() * i;
+
+ if (size > TC_MAX_FAT_CLUSTER_SIZE)
+ break;
+
+ /* ReFS supports only 4KiB and 64KiB clusters */
+ if ((fsType == FILESYS_REFS) && (size != 4*BYTES_PER_KB) && (size != 64*BYTES_PER_KB))
+ continue;
+
+ if (size == 512)
+ s << L"0.5";
+ else
+ s << size / BYTES_PER_KB;
+
+ s << L" " << GetString ("KB");
+
+ AddComboPair (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), s.str().c_str(), i);
+ }
+
+ SendMessage (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), CB_SETCURSEL, 0, 0);
+}
+
/* Except in response to the WM_INITDIALOG message, the dialog box procedure
should return nonzero if it processes the message, and zero if it does
not. - see DialogProc */
@@ -4915,29 +4945,6 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
SetWindowText (GetDlgItem (hwndDlg, IDC_HEADER_KEY), showKeys ? L"" : L"******************************** ");
SetWindowText (GetDlgItem (hwndDlg, IDC_DISK_KEY), showKeys ? L"" : L"******************************** ");
- SendMessage (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), CB_RESETCONTENT, 0, 0);
- AddComboPair (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), GetString ("DEFAULT"), 0);
-
- for (int i = 1; i <= 128; i *= 2)
- {
- wstringstream s;
- DWORD size = GetFormatSectorSize() * i;
-
- if (size > TC_MAX_FAT_CLUSTER_SIZE)
- break;
-
- if (size == 512)
- s << L"0.5";
- else
- s << size / BYTES_PER_KB;
-
- s << L" " << GetString ("KB");
-
- AddComboPair (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), s.str().c_str(), i);
- }
-
- SendMessage (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), CB_SETCURSEL, 0, 0);
-
EnableWindow (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), TRUE);
/* Filesystems */
@@ -5021,6 +5028,8 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
SendMessage (GetDlgItem (hwndDlg, IDC_FILESYS), CB_SETCURSEL, 0, 0);
SelectAlgo (GetDlgItem (hwndDlg, IDC_FILESYS), (int *) &fileSystem);
+ UpdateClusterSizeList (hwndDlg, fileSystem);
+
EnableWindow (GetDlgItem (hwndDlg, IDC_ABORT_BUTTON), FALSE);
SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetString ("FORMAT"));
@@ -5886,6 +5895,11 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
fileSystem = (int) SendMessage (GetDlgItem (hCurPage, IDC_FILESYS), CB_GETITEMDATA,
SendMessage (GetDlgItem (hCurPage, IDC_FILESYS), CB_GETCURSEL, 0, 0) , 0);
+ if (nCurPageNo == FORMAT_PAGE)
+ {
+ UpdateClusterSizeList (hCurPage, fileSystem);
+ }
+
return 1;
}