VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-05-06 18:38:30 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-05-06 21:31:37 (GMT)
commitb3646b323763441359cb953ebd78ef22f9ce428e (patch)
tree47d9e483ba587d0708c7bb58bf0aabb0884a1feb /src/Common
parent061292130d7a5342077d8edb58600a538641cda1 (diff)
downloadVeraCrypt-b3646b323763441359cb953ebd78ef22f9ce428e.zip
VeraCrypt-b3646b323763441359cb953ebd78ef22f9ce428e.tar.gz
Windows: Solve detection issue when resuming encryption. Add separate logic for manual selection of device and display error message in case of failure.
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Dlgcode.c48
-rw-r--r--src/Common/Dlgcode.h6
-rw-r--r--src/Common/Language.xml2
3 files changed, 50 insertions, 6 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index cf85682..673da46 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -3016,6 +3016,7 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
LVCOLUMNW LvCol;
HWND hList = GetDlgItem (hwndDlg, IDC_DEVICELIST);
+ RawDevicesDlgParam* pDlgParam = (RawDevicesDlgParam *) lParam;
LocalizeDialog (hwndDlg, "IDD_RAWDEVICES_DLG");
@@ -3048,9 +3049,14 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
devices.clear();
itemToDeviceMap.clear();
- WaitCursor();
- devices = GetAvailableHostDevices (false, true, false);
- NormalCursor();
+ if (pDlgParam->devices.empty())
+ {
+ WaitCursor();
+ devices = GetAvailableHostDevices (false, true, false);
+ NormalCursor();
+ }
+ else
+ devices = pDlgParam->devices;
if (devices.empty())
{
@@ -3140,7 +3146,7 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
item.iItem = line++;
}
- lpszFileName = (char *) lParam;
+ lpszFileName = pDlgParam->pszFileName;
#ifdef VOLFORMAT
EnableWindow (GetDlgItem (hwndDlg, IDOK), FALSE);
@@ -3153,15 +3159,33 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
// catch non-device line selected
if (msg == WM_NOTIFY && ((LPNMHDR) lParam)->code == LVN_ITEMCHANGED && (((LPNMLISTVIEW) lParam)->uNewState & LVIS_FOCUSED ))
{
+ BOOL bEnableOkButton = FALSE;
LVITEM LvItem;
- memset(&LvItem,0,sizeof(LvItem));
+ memset(&LvItem,0,sizeof(LvItem));
LvItem.mask = LVIF_TEXT | LVIF_PARAM;
LvItem.iItem = ((LPNMLISTVIEW) lParam)->iItem;
LvItem.pszText = lpszFileName;
LvItem.cchTextMax = TC_MAX_PATH;
+ lpszFileName[0] = 0;
SendMessage (GetDlgItem (hwndDlg, IDC_DEVICELIST), LVM_GETITEM, LvItem.iItem, (LPARAM) &LvItem);
- EnableWindow (GetDlgItem ((HWND) hwndDlg, IDOK), lpszFileName[0] != 0 && lpszFileName[0] != ' ');
+ if (lpszFileName[0] != 0 && lpszFileName[0] != ' ')
+ {
+ bEnableOkButton = TRUE;
+#ifdef VOLFORMAT
+ if ( bInPlaceEncNonSysResumed && (WizardMode == WIZARD_MODE_NONSYS_DEVICE)
+ && LvItem.iItem != -1 && itemToDeviceMap.find (LvItem.iItem) != itemToDeviceMap.end()
+ )
+ {
+ const HostDevice selectedDevice = itemToDeviceMap[LvItem.iItem];
+ if (selectedDevice.ContainsSystem)
+ {
+ bEnableOkButton = FALSE;
+ }
+ }
+#endif
+ }
+ EnableWindow (GetDlgItem ((HWND) hwndDlg, IDOK), bEnableOkButton);
return 1;
}
@@ -3181,6 +3205,12 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
if (WizardMode != WIZARD_MODE_SYS_DEVICE)
{
+ if (bInPlaceEncNonSysResumed && (WizardMode == WIZARD_MODE_NONSYS_DEVICE))
+ {
+ // disable selection
+ return 1;
+ }
+
if (AskYesNo ("CONFIRM_SYSTEM_ENCRYPTION_MODE", hwndDlg) == IDNO)
{
EndDialog (hwndDlg, IDCANCEL);
@@ -3243,6 +3273,12 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
if (WizardMode != WIZARD_MODE_SYS_DEVICE)
{
+ if (bInPlaceEncNonSysResumed && (WizardMode == WIZARD_MODE_NONSYS_DEVICE))
+ {
+ // disable selection
+ return 1;
+ }
+
if (AskYesNo ("CONFIRM_SYSTEM_ENCRYPTION_MODE", hwndDlg) == IDNO)
{
NormalCursor ();
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 96d5e86..1c792e7 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -514,6 +514,12 @@ struct HostDevice
std::vector <HostDevice> Partitions;
};
+struct RawDevicesDlgParam
+{
+ std::vector <HostDevice> devices;
+ char *pszFileName;
+};
+
BOOL BrowseFilesInDir (HWND hwndDlg, char *stringId, char *initialDir, char *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter, const wchar_t *initialFileName = NULL, const wchar_t *defaultExtension = NULL);
std::wstring SingleStringToWide (const std::string &singleString);
std::wstring Utf8StringToWide (const std::string &utf8String);
diff --git a/src/Common/Language.xml b/src/Common/Language.xml
index c4d93f2..32fab4c 100644
--- a/src/Common/Language.xml
+++ b/src/Common/Language.xml
@@ -606,6 +606,8 @@
<string lang="en" key="HIDDEN_FILES_PRESENT_IN_KEYFILE_PATH">\n\nWARNING: Hidden file(s) have been found in a keyfile search path. Such hidden files cannot be used as keyfiles. If you need to use them as keyfiles, remove their 'Hidden' attribute (right-click each of them, select 'Properties', uncheck 'Hidden' and click OK). Note: Hidden files are visible only if the corresponding option is enabled (Computer > Organize > 'Folder and search options' > View).</string>
<string lang="en" key="HIDDEN_VOL_PROT_PASSWORD_US_KEYB_LAYOUT">If you are attempting to protect a hidden volume containing a hidden system, please make sure you are using the standard US keyboard layout when typing the password for the hidden volume. This is required due to the fact that the password needs to be typed in the pre-boot environment (before Windows starts) where non-US Windows keyboard layouts are not available.</string>
<string lang="en" key="FOUND_NO_PARTITION_W_DEFERRED_INPLACE_ENC">VeraCrypt has not found any volume where non-system encryption has been interrupted and where the volume header can be decrypted using the supplied password and/or keyfile(s).\n\nPlease make sure the password and/or keyfile(s) are correct and that the partition/volume is not being used by the system or applications (including antivirus software).</string>
+ <string lang="en" key="SELECTED_PARTITION_ALREADY_INPLACE_ENC">The selected partition/device is already fully encrypted.\nHeader Flags = 0x%.8X</string>
+ <string lang="en" key="SELECTED_PARTITION_NOT_INPLACE_ENC">The selected partition/device is not using in-place encryption.\nHeader Flags = 0x%.8X</string>
<string lang="en" key="SYSENC_MOUNT_WITHOUT_PBA_NOTE">\n\nNote: If you are attempting to mount a partition located on an encrypted system drive without pre-boot authentication or to mount the encrypted system partition of an operating system that is not running, you can do so by selecting 'System' > 'Mount Without Pre-Boot Authentication'.</string>
<string lang="en" key="MOUNT_WITHOUT_PBA_VOL_ON_ACTIVE_SYSENC_DRIVE">In this mode, you cannot mount a partition located on a drive whose portion is within the key scope of active system encryption.\n\nBefore you can mount this partition in this mode, you need to either boot an operating system installed on a different drive (encrypted or unencrypted) or boot an unencrypted operating system.</string>
<string lang="en" key="PREV">&lt; &amp;Back</string>