VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Common/Dlgcode.c176
-rw-r--r--src/Common/Dlgcode.h4
-rw-r--r--src/Common/Language.xml1
-rw-r--r--src/ExpandVolume/WinMain.cpp4
-rw-r--r--src/Mount/Mount.c32
-rw-r--r--src/Mount/Mount.rc26
-rw-r--r--src/Mount/Resource.h3
7 files changed, 231 insertions, 15 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 001d7102..3fc5c06a 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -26,6 +26,11 @@
26#include <time.h> 26#include <time.h>
27#include <tchar.h> 27#include <tchar.h>
28#include <Richedit.h> 28#include <Richedit.h>
29#ifdef TCMOUNT
30#include <Shlwapi.h>
31#include <process.h>
32#include <Tlhelp32.h>
33#endif
29 34
30#include "Resource.h" 35#include "Resource.h"
31 36
@@ -108,6 +113,9 @@ BOOL bShowDisconnectedNetworkDrives = FALSE;
108BOOL bHideWaitingDialog = FALSE; 113BOOL bHideWaitingDialog = FALSE;
109BOOL bCmdHideWaitingDialog = FALSE; 114BOOL bCmdHideWaitingDialog = FALSE;
110BOOL bCmdHideWaitingDialogValid = FALSE; 115BOOL bCmdHideWaitingDialogValid = FALSE;
116BOOL bUseSecureDesktop = FALSE;
117BOOL bCmdUseSecureDesktop = FALSE;
118BOOL bCmdUseSecureDesktopValid = FALSE;
111BOOL bStartOnLogon = FALSE; 119BOOL bStartOnLogon = FALSE;
112BOOL bMountDevicesOnLogon = FALSE; 120BOOL bMountDevicesOnLogon = FALSE;
113BOOL bMountFavoritesOnLogon = FALSE; 121BOOL bMountFavoritesOnLogon = FALSE;
@@ -12225,3 +12233,171 @@ BOOL DeleteDirectory (const wchar_t* szDirName)
12225 } 12233 }
12226 return bStatus; 12234 return bStatus;
12227} 12235}
12236
12237#ifdef TCMOUNT
12238/*********************************************************************/
12239
12240static BOOL GenerateRandomString (HWND hwndDlg, LPTSTR szName, DWORD maxCharsCount)
12241{
12242 BOOL bRet = FALSE;
12243 if (Randinit () != ERR_SUCCESS)
12244 {
12245 handleError (hwndDlg, (CryptoAPILastError == ERROR_SUCCESS)? ERR_RAND_INIT_FAILED : ERR_CAPI_INIT_FAILED, SRC_POS);
12246 }
12247 else
12248 {
12249 BYTE* indexes = (BYTE*) malloc (maxCharsCount + 1);
12250 bRet = RandgetBytesFull (hwndDlg, indexes, maxCharsCount + 1, TRUE, TRUE);
12251 if (bRet)
12252 {
12253 static LPCTSTR chars = _T("0123456789@#$%^&_-*abcdefghijklmnopqrstuvwxyz");
12254 DWORD i, charsLen = (DWORD) _tcslen (chars);
12255 DWORD effectiveLen = (indexes[0] % (64 - 16)) + 16; // random length between 16 to 64
12256 effectiveLen = (effectiveLen > maxCharsCount)? maxCharsCount : effectiveLen;
12257
12258 for (i = 0; i < effectiveLen; i++)
12259 {
12260 szName[i] = chars[indexes[i + 1] % charsLen];
12261 }
12262
12263 szName[effectiveLen] = 0;
12264 }
12265 burn (indexes, maxCharsCount + 1);
12266 free (indexes);
12267 }
12268
12269 return bRet;
12270}
12271
12272typedef struct
12273{
12274 HDESK hDesk;
12275 HINSTANCE hInstance;
12276 LPCWSTR lpTemplateName;
12277 DLGPROC lpDialogFunc;
12278 LPARAM dwInitParam;
12279 INT_PTR retValue;
12280} SecureDesktopThreadParam;
12281
12282static DWORD WINAPI SecureDesktopThread(LPVOID lpThreadParameter)
12283{
12284 SecureDesktopThreadParam* pParam = (SecureDesktopThreadParam*) lpThreadParameter;
12285
12286 SetThreadDesktop (pParam->hDesk);
12287 SwitchDesktop (pParam->hDesk);
12288
12289 pParam->retValue = DialogBoxParamW (pParam->hInstance, pParam->lpTemplateName,
12290 NULL, pParam->lpDialogFunc, pParam->dwInitParam);
12291
12292 return 0;
12293}
12294
12295static void GetCtfMonProcessIdList (map<DWORD, BOOL>& processIdList)
12296{
12297 HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
12298 PROCESSENTRY32 pEntry;
12299 BOOL hRes;
12300
12301 pEntry.dwSize = sizeof (pEntry);
12302 processIdList.clear();
12303 hRes = Process32First(hSnapShot, &pEntry);
12304 while (hRes)
12305 {
12306 LPTSTR szFileName = PathFindFileName (pEntry.szExeFile);
12307 if (_wcsicmp(szFileName, L"ctfmon.exe") == 0)
12308 {
12309 processIdList[pEntry.th32ProcessID] = TRUE;
12310 }
12311 hRes = Process32Next(hSnapShot, &pEntry);
12312 }
12313 CloseHandle(hSnapShot);
12314}
12315
12316static void KillProcess (DWORD dwProcessId)
12317{
12318 HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, dwProcessId);
12319 if (hProcess != NULL)
12320 {
12321 TerminateProcess(hProcess, (UINT) -1);
12322 CloseHandle(hProcess);
12323 }
12324}
12325
12326INT_PTR SecureDesktopDialogBoxParam(
12327 HINSTANCE hInstance,
12328 LPCWSTR lpTemplateName,
12329 HWND hWndParent,
12330 DLGPROC lpDialogFunc,
12331 LPARAM dwInitParam)
12332{
12333 TCHAR szDesktopName[65] = {0};
12334 BOOL bSuccess = FALSE;
12335 INT_PTR retValue = 0;
12336 BOOL bEffectiveUseSecureDesktop = bCmdUseSecureDesktopValid? bCmdUseSecureDesktop : bUseSecureDesktop;
12337
12338 if (bEffectiveUseSecureDesktop && GenerateRandomString (hWndParent, szDesktopName, 64))
12339 {
12340 map<DWORD, BOOL> ctfmonBeforeList, ctfmonAfterList;
12341 DWORD desktopAccess = DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS;
12342 HDESK hSecureDesk;
12343
12344 // get the initial list of ctfmon.exe processes before creating new desktop
12345 GetCtfMonProcessIdList (ctfmonBeforeList);
12346
12347 hSecureDesk = CreateDesktop (szDesktopName, NULL, NULL, 0, desktopAccess, NULL);
12348 if (hSecureDesk)
12349 {
12350 HDESK hOriginalDesk = GetThreadDesktop (GetCurrentThreadId ());
12351 SecureDesktopThreadParam param;
12352
12353 param.hDesk = hSecureDesk;
12354 param.hInstance = hInstance;
12355 param.lpTemplateName = lpTemplateName;
12356 param.lpDialogFunc = lpDialogFunc;
12357 param.dwInitParam = dwInitParam;
12358 param.retValue = 0;
12359
12360 HANDLE hThread = ::CreateThread (NULL, 0, SecureDesktopThread, (LPVOID) &param, 0, NULL);
12361 if (hThread)
12362 {
12363 WaitForSingleObject (hThread, INFINITE);
12364 CloseHandle (hThread);
12365
12366 SwitchDesktop (hOriginalDesk);
12367 SetThreadDesktop (hOriginalDesk);
12368
12369 retValue = param.retValue;
12370 bSuccess = TRUE;
12371 }
12372
12373 CloseDesktop (hSecureDesk);
12374
12375 // get the new list of ctfmon.exe processes in order to find the ID of the
12376 // ctfmon.exe instance that corresponds to the desktop we create so that
12377 // we can kill it, otherwise it would remain running
12378 GetCtfMonProcessIdList (ctfmonAfterList);
12379
12380 for (map<DWORD, BOOL>::iterator It = ctfmonAfterList.begin();
12381 It != ctfmonAfterList.end(); It++)
12382 {
12383 if (ctfmonBeforeList[It->first] != TRUE)
12384 {
12385 // Kill process
12386 KillProcess (It->first);
12387 }
12388 }
12389 }
12390
12391 burn (szDesktopName, sizeof (szDesktopName));
12392 }
12393
12394 if (!bSuccess)
12395 {
12396 // fallback to displaying in normal desktop
12397 retValue = DialogBoxParamW (hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwInitParam);
12398 }
12399
12400 return retValue;
12401}
12402
12403#endif
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 86afbe0f..a1930f67 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -121,6 +121,9 @@ extern BOOL bShowDisconnectedNetworkDrives;
121extern BOOL bHideWaitingDialog; 121extern BOOL bHideWaitingDialog;
122extern BOOL bCmdHideWaitingDialog; 122extern BOOL bCmdHideWaitingDialog;
123extern BOOL bCmdHideWaitingDialogValid; 123extern BOOL bCmdHideWaitingDialogValid;
124extern BOOL bUseSecureDesktop;
125extern BOOL bCmdUseSecureDesktop;
126extern BOOL bCmdUseSecureDesktopValid;
124extern BOOL bStartOnLogon; 127extern BOOL bStartOnLogon;
125extern BOOL bMountDevicesOnLogon; 128extern BOOL bMountDevicesOnLogon;
126extern BOOL bMountFavoritesOnLogon; 129extern BOOL bMountFavoritesOnLogon;
@@ -514,6 +517,7 @@ BOOL LaunchElevatedProcess (HWND hwndDlg, const wchar_t* szModPath, const wchar_
514BOOL GetFreeDriveLetter(WCHAR* pCh); 517BOOL GetFreeDriveLetter(WCHAR* pCh);
515BOOL RaisePrivileges(void); 518BOOL RaisePrivileges(void);
516BOOL DeleteDirectory (const wchar_t* szDirName); 519BOOL DeleteDirectory (const wchar_t* szDirName);
520INT_PTR SecureDesktopDialogBoxParam (HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM);
517 521
518#ifdef __cplusplus 522#ifdef __cplusplus
519} 523}
diff --git a/src/Common/Language.xml b/src/Common/Language.xml
index 1addd375..6c5697b4 100644
--- a/src/Common/Language.xml
+++ b/src/Common/Language.xml
@@ -1413,6 +1413,7 @@
1413 <string lang="en" key="RESCUE_DISK_EFI_CHECK_FAILED">Cannot verify that the Rescue Disk has been correctly extracted.\n\nIf you have extracted the Rescue Disk, please eject and reinsert the USB stick; then click Next to try again. If this does not help, please try another USB stick and/or another ZIP software.\n\nIf you have not extracted the Rescue Disk yet, please do so, and then click Next.\n\nIf you attempted to verify a VeraCrypt Rescue Disk created before you started this wizard, please note that such Rescue Disk cannot be used, because it was created for a different master key. You need to extract the newly generated Rescue Disk ZIP image.</string> 1413 <string lang="en" key="RESCUE_DISK_EFI_CHECK_FAILED">Cannot verify that the Rescue Disk has been correctly extracted.\n\nIf you have extracted the Rescue Disk, please eject and reinsert the USB stick; then click Next to try again. If this does not help, please try another USB stick and/or another ZIP software.\n\nIf you have not extracted the Rescue Disk yet, please do so, and then click Next.\n\nIf you attempted to verify a VeraCrypt Rescue Disk created before you started this wizard, please note that such Rescue Disk cannot be used, because it was created for a different master key. You need to extract the newly generated Rescue Disk ZIP image.</string>
1414 <string lang="en" key="RESCUE_DISK_EFI_NON_WIZARD_CHECK_FAILED">Cannot verify that the Rescue Disk has been correctly extracted.\n\nIf you have extracted the Rescue Disk image to a USB stick, please eject it and reinsert it; then try again. If this does not help, please try other ZIP software and/or medium.\n\nIf you attempted to verify a VeraCrypt Rescue Disk created for a different master key, password, salt, etc., please note that such Rescue Disk will always fail this verification. To create a new Rescue Disk fully compatible with your current configuration, select 'System' > 'Create Rescue Disk'.</string> 1414 <string lang="en" key="RESCUE_DISK_EFI_NON_WIZARD_CHECK_FAILED">Cannot verify that the Rescue Disk has been correctly extracted.\n\nIf you have extracted the Rescue Disk image to a USB stick, please eject it and reinsert it; then try again. If this does not help, please try other ZIP software and/or medium.\n\nIf you attempted to verify a VeraCrypt Rescue Disk created for a different master key, password, salt, etc., please note that such Rescue Disk will always fail this verification. To create a new Rescue Disk fully compatible with your current configuration, select 'System' > 'Create Rescue Disk'.</string>
1415 <string lang="en" key="RESCUE_DISK_EFI_NON_WIZARD_CREATION">The Rescue Disk image has been created and stored in this file:\n%s\n\nNow you need to extract the Rescue Disk image to a USB stick that is formatted as FAT/FAT32.\n\nIMPORTANT: Note that the zip file must be extracted directly to the root of the USB stick. For example, if the drive letter of the USB stick is E: then extracting the zip file should create a folder E:\\EFI on the USB stick.\n\nAfter you create the Rescue Disk, select 'System' > 'Verify Rescue Disk' to verify that it has been correctly created.</string> 1415 <string lang="en" key="RESCUE_DISK_EFI_NON_WIZARD_CREATION">The Rescue Disk image has been created and stored in this file:\n%s\n\nNow you need to extract the Rescue Disk image to a USB stick that is formatted as FAT/FAT32.\n\nIMPORTANT: Note that the zip file must be extracted directly to the root of the USB stick. For example, if the drive letter of the USB stick is E: then extracting the zip file should create a folder E:\\EFI on the USB stick.\n\nAfter you create the Rescue Disk, select 'System' > 'Verify Rescue Disk' to verify that it has been correctly created.</string>
1416 <control lang="en" key="IDC_SECURE_DESKTOP_PASSWORD_ENTRY">Use Secure Desktop for password entry</control>
1416 </localization> 1417 </localization>
1417 <!-- XML Schema --> 1418 <!-- XML Schema -->
1418 <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 1419 <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp
index 3172a45f..5ab9718c 100644
--- a/src/ExpandVolume/WinMain.cpp
+++ b/src/ExpandVolume/WinMain.cpp
@@ -284,6 +284,7 @@ void LoadSettings (HWND hwndDlg)
284 bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = ConfigReadInt ("PreserveTimestamps", TRUE); 284 bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = ConfigReadInt ("PreserveTimestamps", TRUE);
285 bShowDisconnectedNetworkDrives = ConfigReadInt ("ShowDisconnectedNetworkDrives", FALSE); 285 bShowDisconnectedNetworkDrives = ConfigReadInt ("ShowDisconnectedNetworkDrives", FALSE);
286 bHideWaitingDialog = ConfigReadInt ("HideWaitingDialog", FALSE); 286 bHideWaitingDialog = ConfigReadInt ("HideWaitingDialog", FALSE);
287 bUseSecureDesktop = ConfigReadInt ("UseSecureDesktop", FALSE);
287 defaultMountOptions.Removable = ConfigReadInt ("MountVolumesRemovable", FALSE); 288 defaultMountOptions.Removable = ConfigReadInt ("MountVolumesRemovable", FALSE);
288 defaultMountOptions.ReadOnly = ConfigReadInt ("MountVolumesReadOnly", FALSE); 289 defaultMountOptions.ReadOnly = ConfigReadInt ("MountVolumesReadOnly", FALSE);
289 defaultMountOptions.ProtectHiddenVolume = FALSE; 290 defaultMountOptions.ProtectHiddenVolume = FALSE;
@@ -815,7 +816,7 @@ int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *pas
815 816
816 StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), fileName); 817 StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), fileName);
817 818
818 result = DialogBoxParamW (hInst, 819 result = SecureDesktopDialogBoxParam (hInst,
819 MAKEINTRESOURCEW (IDD_PASSWORD_DLG), hwndDlg, 820 MAKEINTRESOURCEW (IDD_PASSWORD_DLG), hwndDlg,
820 (DLGPROC) ExtcvPasswordDlgProc, (LPARAM) &dlgParam); 821 (DLGPROC) ExtcvPasswordDlgProc, (LPARAM) &dlgParam);
821 822
@@ -883,6 +884,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
883 bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = TRUE; 884 bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = TRUE;
884 bShowDisconnectedNetworkDrives = FALSE; 885 bShowDisconnectedNetworkDrives = FALSE;
885 bHideWaitingDialog = FALSE; 886 bHideWaitingDialog = FALSE;
887 bUseSecureDesktop = FALSE;
886 888
887 if (UsePreferences) 889 if (UsePreferences)
888 { 890 {
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 12ee7985..28a43acf 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -721,6 +721,8 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL*
721 721
722 ConfigReadCompareInt ("HideWaitingDialog", FALSE, &bHideWaitingDialog, bOnlyCheckModified, pbSettingsModified); 722 ConfigReadCompareInt ("HideWaitingDialog", FALSE, &bHideWaitingDialog, bOnlyCheckModified, pbSettingsModified);
723 723
724 ConfigReadCompareInt ("UseSecureDesktop", FALSE, &bUseSecureDesktop, bOnlyCheckModified, pbSettingsModified);
725
724 ConfigReadCompareInt ("MountVolumesRemovable", FALSE, &defaultMountOptions.Removable, bOnlyCheckModified, pbSettingsModified); 726 ConfigReadCompareInt ("MountVolumesRemovable", FALSE, &defaultMountOptions.Removable, bOnlyCheckModified, pbSettingsModified);
725 ConfigReadCompareInt ("MountVolumesReadOnly", FALSE, &defaultMountOptions.ReadOnly, bOnlyCheckModified, pbSettingsModified); 727 ConfigReadCompareInt ("MountVolumesReadOnly", FALSE, &defaultMountOptions.ReadOnly, bOnlyCheckModified, pbSettingsModified);
726 728
@@ -878,6 +880,7 @@ void SaveSettings (HWND hwndDlg)
878 ConfigWriteInt ("PreserveTimestamps", defaultMountOptions.PreserveTimestamp); 880 ConfigWriteInt ("PreserveTimestamps", defaultMountOptions.PreserveTimestamp);
879 ConfigWriteInt ("ShowDisconnectedNetworkDrives",bShowDisconnectedNetworkDrives); 881 ConfigWriteInt ("ShowDisconnectedNetworkDrives",bShowDisconnectedNetworkDrives);
880 ConfigWriteInt ("HideWaitingDialog", bHideWaitingDialog); 882 ConfigWriteInt ("HideWaitingDialog", bHideWaitingDialog);
883 ConfigWriteInt ("UseSecureDesktop", bUseSecureDesktop);
881 884
882 ConfigWriteInt ("EnableBackgroundTask", bEnableBkgTask); 885 ConfigWriteInt ("EnableBackgroundTask", bEnableBkgTask);
883 ConfigWriteInt ("CloseBackgroundTaskOnNoVolumes", bCloseBkgTaskWhenNoVolumes); 886 ConfigWriteInt ("CloseBackgroundTaskOnNoVolumes", bCloseBkgTaskWhenNoVolumes);
@@ -3132,6 +3135,9 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
3132 SendMessage (GetDlgItem (hwndDlg, IDC_HIDE_WAITING_DIALOG), BM_SETCHECK, 3135 SendMessage (GetDlgItem (hwndDlg, IDC_HIDE_WAITING_DIALOG), BM_SETCHECK,
3133 bHideWaitingDialog ? BST_CHECKED:BST_UNCHECKED, 0); 3136 bHideWaitingDialog ? BST_CHECKED:BST_UNCHECKED, 0);
3134 3137
3138 SendMessage (GetDlgItem (hwndDlg, IDC_SECURE_DESKTOP_PASSWORD_ENTRY), BM_SETCHECK,
3139 bUseSecureDesktop ? BST_CHECKED:BST_UNCHECKED, 0);
3140
3135 SendMessage (GetDlgItem (hwndDlg, IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT), BM_SETCHECK, 3141 SendMessage (GetDlgItem (hwndDlg, IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT), BM_SETCHECK,
3136 bCacheDuringMultipleMount ? BST_CHECKED:BST_UNCHECKED, 0); 3142 bCacheDuringMultipleMount ? BST_CHECKED:BST_UNCHECKED, 0);
3137 3143
@@ -3247,6 +3253,7 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
3247 bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PRESERVE_TIMESTAMPS)); 3253 bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PRESERVE_TIMESTAMPS));
3248 bShowDisconnectedNetworkDrives = IsButtonChecked (GetDlgItem (hwndDlg, IDC_SHOW_DISCONNECTED_NETWORK_DRIVES)); 3254 bShowDisconnectedNetworkDrives = IsButtonChecked (GetDlgItem (hwndDlg, IDC_SHOW_DISCONNECTED_NETWORK_DRIVES));
3249 bHideWaitingDialog = IsButtonChecked (GetDlgItem (hwndDlg, IDC_HIDE_WAITING_DIALOG)); 3255 bHideWaitingDialog = IsButtonChecked (GetDlgItem (hwndDlg, IDC_HIDE_WAITING_DIALOG));
3256 bUseSecureDesktop = IsButtonChecked (GetDlgItem (hwndDlg, IDC_SECURE_DESKTOP_PASSWORD_ENTRY));
3250 bCacheDuringMultipleMount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT)); 3257 bCacheDuringMultipleMount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT));
3251 bWipeCacheOnExit = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_WIPE_CACHE_ON_EXIT)); 3258 bWipeCacheOnExit = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_WIPE_CACHE_ON_EXIT));
3252 bWipeCacheOnAutoDismount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT)); 3259 bWipeCacheOnAutoDismount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT));
@@ -4537,7 +4544,7 @@ static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int
4537 dlgParam.pim = pim; 4544 dlgParam.pim = pim;
4538 dlgParam.truecryptMode = truecryptMode; 4545 dlgParam.truecryptMode = truecryptMode;
4539 4546
4540 result = DialogBoxParamW (hInst, 4547 result = SecureDesktopDialogBoxParam (hInst,
4541 MAKEINTRESOURCEW (IDD_PASSWORD_DLG), hwndDlg, 4548 MAKEINTRESOURCEW (IDD_PASSWORD_DLG), hwndDlg,
4542 (DLGPROC) PasswordDlgProc, (LPARAM) &dlgParam); 4549 (DLGPROC) PasswordDlgProc, (LPARAM) &dlgParam);
4543 4550
@@ -6440,6 +6447,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
6440 bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = TRUE; 6447 bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = TRUE;
6441 bShowDisconnectedNetworkDrives = FALSE; 6448 bShowDisconnectedNetworkDrives = FALSE;
6442 bHideWaitingDialog = FALSE; 6449 bHideWaitingDialog = FALSE;
6450 bUseSecureDesktop = FALSE;
6443 6451
6444 ResetWrongPwdRetryCount (); 6452 ResetWrongPwdRetryCount ();
6445 6453
@@ -8449,6 +8457,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
8449 OptionPim, 8457 OptionPim,
8450 OptionTryEmptyPassword, 8458 OptionTryEmptyPassword,
8451 OptionNoWaitDlg, 8459 OptionNoWaitDlg,
8460 OptionSecureDesktop,
8452 }; 8461 };
8453 8462
8454 argument args[]= 8463 argument args[]=
@@ -8476,6 +8485,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
8476 { CommandWipeCache, L"/wipecache", L"/w", FALSE }, 8485 { CommandWipeCache, L"/wipecache", L"/w", FALSE },
8477 { OptionTryEmptyPassword, L"/tryemptypass", NULL, FALSE }, 8486 { OptionTryEmptyPassword, L"/tryemptypass", NULL, FALSE },
8478 { OptionNoWaitDlg, L"/nowaitdlg", NULL, FALSE }, 8487 { OptionNoWaitDlg, L"/nowaitdlg", NULL, FALSE },
8488 { OptionSecureDesktop, L"/secureDesktop", NULL, FALSE },
8479 }; 8489 };
8480 8490
8481 argumentspec as; 8491 argumentspec as;
@@ -8547,6 +8557,25 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
8547 } 8557 }
8548 break; 8558 break;
8549 8559
8560 case OptionSecureDesktop:
8561 {
8562 wchar_t szTmp[16] = {0};
8563 bCmdUseSecureDesktop = TRUE;
8564 bCmdUseSecureDesktopValid = TRUE;
8565
8566 if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs,
8567 szTmp, ARRAYSIZE (szTmp)))
8568 {
8569 if (!_wcsicmp(szTmp,L"n") || !_wcsicmp(szTmp,L"no"))
8570 bCmdUseSecureDesktop = FALSE;
8571 else if (!_wcsicmp(szTmp,L"y") || !_wcsicmp(szTmp,L"yes"))
8572 bCmdUseSecureDesktop = TRUE;
8573 else
8574 AbortProcess ("COMMAND_LINE_ERROR");
8575 }
8576 }
8577 break;
8578
8550 case OptionCache: 8579 case OptionCache:
8551 { 8580 {
8552 wchar_t szTmp[16] = {0}; 8581 wchar_t szTmp[16] = {0};
@@ -8972,6 +9001,7 @@ static BOOL StartSystemFavoritesService ()
8972 DeviceChangeBroadcastDisabled = TRUE; 9001 DeviceChangeBroadcastDisabled = TRUE;
8973 bShowDisconnectedNetworkDrives = TRUE; 9002 bShowDisconnectedNetworkDrives = TRUE;
8974 bHideWaitingDialog = TRUE; 9003 bHideWaitingDialog = TRUE;
9004 bUseSecureDesktop = FALSE;
8975 9005
8976 InitOSVersionInfo(); 9006 InitOSVersionInfo();
8977 9007
diff --git a/src/Mount/Mount.rc b/src/Mount/Mount.rc
index 03496871..2f96bff7 100644
--- a/src/Mount/Mount.rc
+++ b/src/Mount/Mount.rc
@@ -41,7 +41,7 @@ IDR_MOUNT_TLB TYPELIB "Mount.tlb"
41// Dialog 41// Dialog
42// 42//
43 43
44IDD_PREFERENCES_DLG DIALOGEX 0, 0, 336, 333 44IDD_PREFERENCES_DLG DIALOGEX 0, 0, 336, 340
45STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU 45STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
46CAPTION "VeraCrypt - Preferences" 46CAPTION "VeraCrypt - Preferences"
47FONT 8, "MS Shell Dlg", 400, 0, 0x1 47FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -78,28 +78,30 @@ BEGIN
78 CONTROL "Make disconnected network drives available for mounting",IDC_SHOW_DISCONNECTED_NETWORK_DRIVES, 78 CONTROL "Make disconnected network drives available for mounting",IDC_SHOW_DISCONNECTED_NETWORK_DRIVES,
79 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,208,316,10 79 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,208,316,10
80 CONTROL "Cache passwords in driver memory",IDC_PREF_CACHE_PASSWORDS, 80 CONTROL "Cache passwords in driver memory",IDC_PREF_CACHE_PASSWORDS,
81 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,254,146,11 81 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,263,146,11
82 CONTROL "Wipe cached passwords on exit",IDC_PREF_WIPE_CACHE_ON_EXIT, 82 CONTROL "Wipe cached passwords on exit",IDC_PREF_WIPE_CACHE_ON_EXIT,
83 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,254,165,11 83 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,263,165,11
84 CONTROL "Temporarily cache password during ""Mount Favorite Volumes"" operations",IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT, 84 CONTROL "Temporarily cache password during ""Mount Favorite Volumes"" operations",IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT,
85 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,268,294,11 85 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,277,294,11
86 CONTROL "Wipe cached passwords on auto-dismount",IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT, 86 CONTROL "Wipe cached passwords on auto-dismount",IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT,
87 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,282,296,11 87 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,291,296,11
88 CONTROL "Include PIM when caching a password",IDC_PREF_CACHE_PIM, 88 CONTROL "Include PIM when caching a password",IDC_PREF_CACHE_PIM,
89 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,296,296,10 89 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,305,296,10
90 PUSHBUTTON "More Settings...",IDC_MORE_SETTINGS,5,317,85,14 90 PUSHBUTTON "More Settings...",IDC_MORE_SETTINGS,5,324,85,14
91 DEFPUSHBUTTON "OK",IDOK,225,317,50,14 91 DEFPUSHBUTTON "OK",IDOK,225,324,50,14
92 PUSHBUTTON "Cancel",IDCANCEL,281,317,50,14 92 PUSHBUTTON "Cancel",IDCANCEL,281,324,50,14
93 GROUPBOX "Windows",IDT_WINDOWS_RELATED_SETTING,4,160,328,76 93 GROUPBOX "Windows",IDT_WINDOWS_RELATED_SETTING,4,160,328,87
94 GROUPBOX "Default Mount Options",IDT_DEFAULT_MOUNT_OPTIONS,4,3,328,26 94 GROUPBOX "Default Mount Options",IDT_DEFAULT_MOUNT_OPTIONS,4,3,328,26
95 GROUPBOX "VeraCrypt Background Task",IDT_TASKBAR_ICON,4,33,328,26 95 GROUPBOX "VeraCrypt Background Task",IDT_TASKBAR_ICON,4,33,328,26
96 GROUPBOX "Auto-Dismount",IDT_AUTO_DISMOUNT,4,94,328,62 96 GROUPBOX "Auto-Dismount",IDT_AUTO_DISMOUNT,4,94,328,62
97 LTEXT "minutes",IDT_MINUTES,289,129,39,10 97 LTEXT "minutes",IDT_MINUTES,289,129,39,10
98 LTEXT "Dismount all when:",IDT_AUTO_DISMOUNT_ON,9,104,71,20 98 LTEXT "Dismount all when:",IDT_AUTO_DISMOUNT_ON,9,104,71,20
99 GROUPBOX "Password Cache",IDT_PW_CACHE_OPTIONS,4,243,328,68 99 GROUPBOX "Password Cache",IDT_PW_CACHE_OPTIONS,4,252,328,68
100 GROUPBOX "Actions to perform upon logon to Windows",IDT_LOGON,4,63,328,28 100 GROUPBOX "Actions to perform upon logon to Windows",IDT_LOGON,4,63,328,28
101 CONTROL "Don't show wait message dialog when performing operations",IDC_HIDE_WAITING_DIALOG, 101 CONTROL "Don't show wait message dialog when performing operations",IDC_HIDE_WAITING_DIALOG,
102 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,220,316,10 102 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,220,316,10
103 CONTROL "Use Secure Desktop for password entry",IDC_SECURE_DESKTOP_PASSWORD_ENTRY,
104 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,232,316,10
103END 105END
104 106
105IDD_VOLUME_PROPERTIES DIALOGEX 60, 30, 284, 224 107IDD_VOLUME_PROPERTIES DIALOGEX 60, 30, 284, 224
@@ -421,7 +423,7 @@ BEGIN
421 LEFTMARGIN, 7 423 LEFTMARGIN, 7
422 RIGHTMARGIN, 329 424 RIGHTMARGIN, 329
423 TOPMARGIN, 7 425 TOPMARGIN, 7
424 BOTTOMMARGIN, 331 426 BOTTOMMARGIN, 338
425 END 427 END
426 428
427 IDD_VOLUME_PROPERTIES, DIALOG 429 IDD_VOLUME_PROPERTIES, DIALOG
diff --git a/src/Mount/Resource.h b/src/Mount/Resource.h
index 12860915..0c863386 100644
--- a/src/Mount/Resource.h
+++ b/src/Mount/Resource.h
@@ -183,6 +183,7 @@
183#define IDC_DISABLE_BOOT_LOADER_PIM_PROMPT 1160 183#define IDC_DISABLE_BOOT_LOADER_PIM_PROMPT 1160
184#define IDC_HIDE_WAITING_DIALOG 1161 184#define IDC_HIDE_WAITING_DIALOG 1161
185#define IDC_DISABLE_BOOT_LOADER_HASH_PROMPT 1162 185#define IDC_DISABLE_BOOT_LOADER_HASH_PROMPT 1162
186#define IDC_SECURE_DESKTOP_PASSWORD_ENTRY 1163
186#define IDM_HELP 40001 187#define IDM_HELP 40001
187#define IDM_ABOUT 40002 188#define IDM_ABOUT 40002
188#define IDM_UNMOUNT_VOLUME 40003 189#define IDM_UNMOUNT_VOLUME 40003
@@ -259,7 +260,7 @@
259#define _APS_NO_MFC 1 260#define _APS_NO_MFC 1
260#define _APS_NEXT_RESOURCE_VALUE 120 261#define _APS_NEXT_RESOURCE_VALUE 120
261#define _APS_NEXT_COMMAND_VALUE 40069 262#define _APS_NEXT_COMMAND_VALUE 40069
262#define _APS_NEXT_CONTROL_VALUE 1163 263#define _APS_NEXT_CONTROL_VALUE 1164
263#define _APS_NEXT_SYMED_VALUE 101 264#define _APS_NEXT_SYMED_VALUE 101
264#endif 265#endif
265#endif 266#endif