mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-30 15:03:31 +01:00
Windows: Don't allow a directory path to be entered for the file container to be created in Format wizard
This commit is contained in:
parent
5649a8b20d
commit
c9b5c1073d
@ -5633,8 +5633,24 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
if (hw == CBN_EDITCHANGE && nCurPageNo == VOLUME_LOCATION_PAGE)
|
if (hw == CBN_EDITCHANGE && nCurPageNo == VOLUME_LOCATION_PAGE)
|
||||||
{
|
{
|
||||||
|
BOOL bValidEntry = (GetWindowTextLength (GetDlgItem (hCurPage, IDC_COMBO_BOX)) > 0)? TRUE : FALSE;
|
||||||
|
|
||||||
|
if (bValidEntry && !bDevice)
|
||||||
|
{
|
||||||
|
/* check that the entered path is not for an existing directory */
|
||||||
|
WCHAR szEnteredFilePath[TC_MAX_PATH + 1] = {0};
|
||||||
|
GetWindowTextW (GetDlgItem (hCurPage, IDC_COMBO_BOX), szEnteredFilePath, ARRAYSIZE (szEnteredFilePath));
|
||||||
|
RelativePath2Absolute (szEnteredFilePath);
|
||||||
|
|
||||||
|
DWORD dwAttr = GetFileAttributes (szEnteredFilePath);
|
||||||
|
if ((dwAttr != INVALID_FILE_ATTRIBUTES) && (dwAttr & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
|
{
|
||||||
|
/* this is a directory. Consider it as invalid */
|
||||||
|
bValidEntry = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT),
|
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT),
|
||||||
GetWindowTextLength (GetDlgItem (hCurPage, IDC_COMBO_BOX)) > 0);
|
bValidEntry);
|
||||||
|
|
||||||
bDeviceTransformModeChoiceMade = FALSE;
|
bDeviceTransformModeChoiceMade = FALSE;
|
||||||
bInPlaceEncNonSys = FALSE;
|
bInPlaceEncNonSys = FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user