Windows: Don't show disconnected network drives in the list of available drives. Add option to make them available for mounting if needed.

This commit is contained in:
Mounir IDRASSI 2016-01-10 19:35:57 +01:00
parent 5597a1e390
commit fb430c403b
12 changed files with 109 additions and 42 deletions

View File

@ -101,6 +101,7 @@ wchar_t *lpszTitle = NULL;
BOOL Silent = FALSE; BOOL Silent = FALSE;
BOOL bPreserveTimestamp = TRUE; BOOL bPreserveTimestamp = TRUE;
BOOL bShowDisconnectedNetworkDrives = FALSE;
BOOL bStartOnLogon = FALSE; BOOL bStartOnLogon = FALSE;
BOOL bMountDevicesOnLogon = FALSE; BOOL bMountDevicesOnLogon = FALSE;
BOOL bMountFavoritesOnLogon = FALSE; BOOL bMountFavoritesOnLogon = FALSE;
@ -225,6 +226,7 @@ HMODULE hbcryptdll = NULL;
HMODULE hbcryptprimitivesdll = NULL; HMODULE hbcryptprimitivesdll = NULL;
HMODULE hMsls31 = NULL; HMODULE hMsls31 = NULL;
HMODULE hntmartadll = NULL; HMODULE hntmartadll = NULL;
HMODULE hwinscarddll = NULL;
#define FREE_DLL(h) if (h) { FreeLibrary (h); h = NULL;} #define FREE_DLL(h) if (h) { FreeLibrary (h); h = NULL;}
@ -572,6 +574,7 @@ void AbortProcessDirect (wchar_t *abortMsg)
FREE_DLL (hbcryptprimitivesdll); FREE_DLL (hbcryptprimitivesdll);
FREE_DLL (hMsls31); FREE_DLL (hMsls31);
FREE_DLL (hntmartadll); FREE_DLL (hntmartadll);
FREE_DLL (hwinscarddll);
exit (1); exit (1);
} }
@ -620,6 +623,7 @@ void AbortProcessSilent (void)
FREE_DLL (hbcryptprimitivesdll); FREE_DLL (hbcryptprimitivesdll);
FREE_DLL (hMsls31); FREE_DLL (hMsls31);
FREE_DLL (hntmartadll); FREE_DLL (hntmartadll);
FREE_DLL (hwinscarddll);
// Note that this function also causes localcleanup() to be called (see atexit()) // Note that this function also causes localcleanup() to be called (see atexit())
exit (1); exit (1);
@ -2492,6 +2496,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
InitOSVersionInfo(); InitOSVersionInfo();
LoadSystemDll (L"ntmarta.dll", &hntmartadll, TRUE, SRC_POS); LoadSystemDll (L"ntmarta.dll", &hntmartadll, TRUE, SRC_POS);
LoadSystemDll (L"MPR.DLL", &hmprdll, TRUE, SRC_POS);
#ifdef SETUP #ifdef SETUP
if (IsOSAtLeast (WIN_7)) if (IsOSAtLeast (WIN_7))
{ {
@ -2529,7 +2534,6 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
LoadSystemDll (L"netapi32.dll", &hnetapi32dll, TRUE, SRC_POS); LoadSystemDll (L"netapi32.dll", &hnetapi32dll, TRUE, SRC_POS);
LoadSystemDll (L"authz.dll", &hauthzdll, TRUE, SRC_POS); LoadSystemDll (L"authz.dll", &hauthzdll, TRUE, SRC_POS);
LoadSystemDll (L"xmllite.dll", &hxmllitedll, TRUE, SRC_POS); LoadSystemDll (L"xmllite.dll", &hxmllitedll, TRUE, SRC_POS);
LoadSystemDll (L"mpr.dll", &hmprdll, TRUE, SRC_POS);
} }
} }
@ -2555,6 +2559,8 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
LoadSystemDll (L"bcryptprimitives.dll", &hbcryptprimitivesdll, TRUE, SRC_POS); LoadSystemDll (L"bcryptprimitives.dll", &hbcryptprimitivesdll, TRUE, SRC_POS);
} }
} }
#else
LoadSystemDll (L"WINSCARD.DLL", &hwinscarddll, TRUE, SRC_POS);
#endif #endif
LoadSystemDll (L"COMCTL32.DLL", &hComctl32Dll, FALSE, SRC_POS); LoadSystemDll (L"COMCTL32.DLL", &hComctl32Dll, FALSE, SRC_POS);
@ -2804,6 +2810,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
FREE_DLL (hbcryptprimitivesdll); FREE_DLL (hbcryptprimitivesdll);
FREE_DLL (hMsls31); FREE_DLL (hMsls31);
FREE_DLL (hntmartadll); FREE_DLL (hntmartadll);
FREE_DLL (hwinscarddll);
exit (1); exit (1);
} }
#endif #endif
@ -2847,6 +2854,7 @@ void FinalizeApp (void)
FREE_DLL (hbcryptprimitivesdll); FREE_DLL (hbcryptprimitivesdll);
FREE_DLL (hMsls31); FREE_DLL (hMsls31);
FREE_DLL (hntmartadll); FREE_DLL (hntmartadll);
FREE_DLL (hwinscarddll);
} }
void InitHelpFileName (void) void InitHelpFileName (void)
@ -6506,10 +6514,40 @@ BOOL WrongPwdRetryCountOverLimit (void)
return (WrongPwdRetryCounter > TC_TRY_HEADER_BAK_AFTER_NBR_WRONG_PWD_TRIES); return (WrongPwdRetryCounter > TC_TRY_HEADER_BAK_AFTER_NBR_WRONG_PWD_TRIES);
} }
DWORD GetUsedLogicalDrives (void)
{
DWORD dwUsedDrives = GetLogicalDrives();
if (!bShowDisconnectedNetworkDrives)
{
/* detect disconnected mapped network shares and removed
* their associated drives from the list
*/
WCHAR remotePath[512];
WCHAR drive[3] = {L'A', L':', 0};
DWORD dwLen, status;
for (WCHAR i = 0; i <= MAX_MOUNTED_VOLUME_DRIVE_NUMBER; i++)
{
if ((dwUsedDrives & (1 << i)) == 0)
{
drive[0] = L'A' + i;
dwLen = ARRAYSIZE (remotePath);
status = WNetGetConnection (drive, remotePath, &dwLen);
if ((NO_ERROR == status) || (status == ERROR_CONNECTION_UNAVAIL))
{
/* this is a mapped network share, mark it as used */
dwUsedDrives |= (1 << i);
}
}
}
}
return dwUsedDrives;
}
int GetFirstAvailableDrive () int GetFirstAvailableDrive ()
{ {
DWORD dwUsedDrives = GetLogicalDrives(); DWORD dwUsedDrives = GetUsedLogicalDrives();
int i; int i;
for (i = 0; i < 26; i++) for (i = 0; i < 26; i++)
@ -6524,7 +6562,7 @@ int GetFirstAvailableDrive ()
int GetLastAvailableDrive () int GetLastAvailableDrive ()
{ {
DWORD dwUsedDrives = GetLogicalDrives(); DWORD dwUsedDrives = GetUsedLogicalDrives();
int i; int i;
for (i = 25; i >= 0; i--) for (i = 25; i >= 0; i--)
@ -6539,7 +6577,7 @@ int GetLastAvailableDrive ()
BOOL IsDriveAvailable (int driveNo) BOOL IsDriveAvailable (int driveNo)
{ {
return (GetLogicalDrives() & (1 << driveNo)) == 0; return (GetUsedLogicalDrives() & (1 << driveNo)) == 0;
} }

View File

@ -115,6 +115,7 @@ extern HWND MainDlg;
extern BOOL Silent; extern BOOL Silent;
extern BOOL bHistory; extern BOOL bHistory;
extern BOOL bPreserveTimestamp; extern BOOL bPreserveTimestamp;
extern BOOL bShowDisconnectedNetworkDrives;
extern BOOL bStartOnLogon; extern BOOL bStartOnLogon;
extern BOOL bMountDevicesOnLogon; extern BOOL bMountDevicesOnLogon;
extern BOOL bMountFavoritesOnLogon; extern BOOL bMountFavoritesOnLogon;
@ -330,6 +331,7 @@ void CorrectFileName (wchar_t* fileName);
void IncreaseWrongPwdRetryCount (int count); void IncreaseWrongPwdRetryCount (int count);
void ResetWrongPwdRetryCount (void); void ResetWrongPwdRetryCount (void);
BOOL WrongPwdRetryCountOverLimit (void); BOOL WrongPwdRetryCountOverLimit (void);
DWORD GetUsedLogicalDrives (void);
int GetFirstAvailableDrive (); int GetFirstAvailableDrive ();
int GetLastAvailableDrive (); int GetLastAvailableDrive ();
BOOL IsDriveAvailable (int driveNo); BOOL IsDriveAvailable (int driveNo);

View File

@ -181,6 +181,7 @@
<control lang="en" key="IDC_SELECT_DEVICE">Select D&amp;evice...</control> <control lang="en" key="IDC_SELECT_DEVICE">Select D&amp;evice...</control>
<control lang="en" key="IDC_SELECT_FILE">Select &amp;File...</control> <control lang="en" key="IDC_SELECT_FILE">Select &amp;File...</control>
<control lang="en" key="IDC_SELECT_PKCS11_MODULE">Select &amp;Library...</control> <control lang="en" key="IDC_SELECT_PKCS11_MODULE">Select &amp;Library...</control>
<control lang="en" key="IDC_SHOW_DISCONNECTED_NETWORK_DRIVES">Make disconnected network drives available for mounting</control>
<control lang="en" key="IDC_SHOW_PASSWORD_CHPWD_NEW">Display password</control> <control lang="en" key="IDC_SHOW_PASSWORD_CHPWD_NEW">Display password</control>
<control lang="en" key="IDC_SHOW_PASSWORD_CHPWD_ORI">Display password</control> <control lang="en" key="IDC_SHOW_PASSWORD_CHPWD_ORI">Display password</control>
<control lang="en" key="IDC_TRAVEL_OPEN_EXPLORER">Open &amp;Explorer window for mounted volume</control> <control lang="en" key="IDC_TRAVEL_OPEN_EXPLORER">Open &amp;Explorer window for mounted volume</control>

View File

@ -75,11 +75,12 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="..\Crypto\Debug\crypto.lib" AdditionalDependencies="..\Crypto\Debug\crypto.lib mpr.lib"
OutputFile="$(OutDir)/VeraCryptExpander.exe" OutputFile="$(OutDir)/VeraCryptExpander.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
DelayLoadDLLs="mpr.dll"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/ExpandVolume.pdb" ProgramDatabaseFile="$(OutDir)/ExpandVolume.pdb"
SubSystem="2" SubSystem="2"
@ -168,11 +169,12 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="..\Crypto\x64\Debug\crypto.lib" AdditionalDependencies="..\Crypto\x64\Debug\crypto.lib mpr.lib"
OutputFile="$(OutDir)/VeraCryptExpander.exe" OutputFile="$(OutDir)/VeraCryptExpander.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
DelayLoadDLLs="mpr.dll"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/ExpandVolume.pdb" ProgramDatabaseFile="$(OutDir)/ExpandVolume.pdb"
SubSystem="2" SubSystem="2"
@ -256,11 +258,12 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="..\Crypto\Release\crypto.lib" AdditionalDependencies="..\Crypto\Release\crypto.lib mpr.lib"
OutputFile="$(OutDir)/VeraCryptExpander.exe" OutputFile="$(OutDir)/VeraCryptExpander.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
DelayLoadDLLs="mpr.dll"
GenerateDebugInformation="false" GenerateDebugInformation="false"
GenerateMapFile="true" GenerateMapFile="true"
SubSystem="2" SubSystem="2"
@ -347,11 +350,12 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="..\Crypto\x64\Release\crypto.lib" AdditionalDependencies="..\Crypto\x64\Release\crypto.lib mpr.lib"
OutputFile="$(OutDir)/VeraCryptExpander.exe" OutputFile="$(OutDir)/VeraCryptExpander.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
DelayLoadDLLs="mpr.dll"
GenerateDebugInformation="false" GenerateDebugInformation="false"
GenerateMapFile="true" GenerateMapFile="true"
SubSystem="2" SubSystem="2"

View File

@ -282,6 +282,7 @@ void LoadSettings (HWND hwndDlg)
defaultKeyFilesParam.EnableKeyFiles = ConfigReadInt ("UseKeyfiles", FALSE); defaultKeyFilesParam.EnableKeyFiles = ConfigReadInt ("UseKeyfiles", FALSE);
bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = ConfigReadInt ("PreserveTimestamps", TRUE); bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = ConfigReadInt ("PreserveTimestamps", TRUE);
bShowDisconnectedNetworkDrives = ConfigReadInt ("ShowDisconnectedNetworkDrives", FALSE);
defaultMountOptions.Removable = ConfigReadInt ("MountVolumesRemovable", FALSE); defaultMountOptions.Removable = ConfigReadInt ("MountVolumesRemovable", FALSE);
defaultMountOptions.ReadOnly = ConfigReadInt ("MountVolumesReadOnly", FALSE); defaultMountOptions.ReadOnly = ConfigReadInt ("MountVolumesReadOnly", FALSE);
defaultMountOptions.ProtectHiddenVolume = FALSE; defaultMountOptions.ProtectHiddenVolume = FALSE;
@ -871,6 +872,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
// Set critical default options in case UsePreferences is false // Set critical default options in case UsePreferences is false
bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = TRUE; bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = TRUE;
bShowDisconnectedNetworkDrives = FALSE;
if (UsePreferences) if (UsePreferences)
{ {

View File

@ -68,11 +68,12 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="..\Crypto\Debug\crypto.lib" AdditionalDependencies="..\Crypto\Debug\crypto.lib mpr.lib"
OutputFile="$(OutDir)/VeraCryptFormat.exe" OutputFile="$(OutDir)/VeraCryptFormat.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
DelayLoadDLLs="mpr.dll"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/Format.pdb" ProgramDatabaseFile="$(OutDir)/Format.pdb"
SubSystem="2" SubSystem="2"
@ -154,11 +155,12 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="..\Crypto\x64\Debug\crypto.lib" AdditionalDependencies="..\Crypto\x64\Debug\crypto.lib mpr.lib"
OutputFile="$(OutDir)/VeraCryptFormat.exe" OutputFile="$(OutDir)/VeraCryptFormat.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
DelayLoadDLLs="mpr.dll"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/Format.pdb" ProgramDatabaseFile="$(OutDir)/Format.pdb"
SubSystem="2" SubSystem="2"
@ -240,11 +242,12 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="..\Crypto\Release\crypto.lib" AdditionalDependencies="..\Crypto\Release\crypto.lib mpr.lib"
OutputFile="$(OutDir)/VeraCryptFormat.exe" OutputFile="$(OutDir)/VeraCryptFormat.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
DelayLoadDLLs="mpr.dll"
GenerateDebugInformation="false" GenerateDebugInformation="false"
GenerateMapFile="true" GenerateMapFile="true"
SubSystem="2" SubSystem="2"
@ -329,11 +332,12 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="..\Crypto\x64\Release\crypto.lib" AdditionalDependencies="..\Crypto\x64\Release\crypto.lib mpr.lib"
OutputFile="$(OutDir)/VeraCryptFormat.exe" OutputFile="$(OutDir)/VeraCryptFormat.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
DelayLoadDLLs="mpr.dll"
GenerateDebugInformation="false" GenerateDebugInformation="false"
GenerateMapFile="true" GenerateMapFile="true"
SubSystem="2" SubSystem="2"

Binary file not shown.

View File

@ -705,6 +705,8 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL*
if (!bOnlyCheckModified) if (!bOnlyCheckModified)
bPreserveTimestamp = defaultMountOptions.PreserveTimestamp; bPreserveTimestamp = defaultMountOptions.PreserveTimestamp;
ConfigReadCompareInt ("ShowDisconnectedNetworkDrives", FALSE, &bShowDisconnectedNetworkDrives, bOnlyCheckModified, pbSettingsModified);
ConfigReadCompareInt ("MountVolumesRemovable", FALSE, &defaultMountOptions.Removable, bOnlyCheckModified, pbSettingsModified); ConfigReadCompareInt ("MountVolumesRemovable", FALSE, &defaultMountOptions.Removable, bOnlyCheckModified, pbSettingsModified);
ConfigReadCompareInt ("MountVolumesReadOnly", FALSE, &defaultMountOptions.ReadOnly, bOnlyCheckModified, pbSettingsModified); ConfigReadCompareInt ("MountVolumesReadOnly", FALSE, &defaultMountOptions.ReadOnly, bOnlyCheckModified, pbSettingsModified);
@ -860,6 +862,7 @@ void SaveSettings (HWND hwndDlg)
ConfigWriteInt ("MountVolumesReadOnly", defaultMountOptions.ReadOnly); ConfigWriteInt ("MountVolumesReadOnly", defaultMountOptions.ReadOnly);
ConfigWriteInt ("MountVolumesRemovable", defaultMountOptions.Removable); ConfigWriteInt ("MountVolumesRemovable", defaultMountOptions.Removable);
ConfigWriteInt ("PreserveTimestamps", defaultMountOptions.PreserveTimestamp); ConfigWriteInt ("PreserveTimestamps", defaultMountOptions.PreserveTimestamp);
ConfigWriteInt ("ShowDisconnectedNetworkDrives",bShowDisconnectedNetworkDrives);
ConfigWriteInt ("EnableBackgroundTask", bEnableBkgTask); ConfigWriteInt ("EnableBackgroundTask", bEnableBkgTask);
ConfigWriteInt ("CloseBackgroundTaskOnNoVolumes", bCloseBkgTaskWhenNoVolumes); ConfigWriteInt ("CloseBackgroundTaskOnNoVolumes", bCloseBkgTaskWhenNoVolumes);
@ -1454,7 +1457,7 @@ void LoadDriveLetters (HWND hwndDlg, HWND hTree, int drive)
AbortProcessSilent(); AbortProcessSilent();
} }
LastKnownLogicalDrives = dwUsedDrives = GetLogicalDrives (); LastKnownLogicalDrives = dwUsedDrives = GetUsedLogicalDrives ();
if (dwUsedDrives == 0) if (dwUsedDrives == 0)
Warning ("DRIVELETTERS", hwndDlg); Warning ("DRIVELETTERS", hwndDlg);
@ -3069,6 +3072,9 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SendMessage (GetDlgItem (hwndDlg, IDC_PRESERVE_TIMESTAMPS), BM_SETCHECK, SendMessage (GetDlgItem (hwndDlg, IDC_PRESERVE_TIMESTAMPS), BM_SETCHECK,
defaultMountOptions.PreserveTimestamp ? BST_CHECKED:BST_UNCHECKED, 0); defaultMountOptions.PreserveTimestamp ? BST_CHECKED:BST_UNCHECKED, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_SHOW_DISCONNECTED_NETWORK_DRIVES), BM_SETCHECK,
bShowDisconnectedNetworkDrives ? BST_CHECKED:BST_UNCHECKED, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT), BM_SETCHECK, SendMessage (GetDlgItem (hwndDlg, IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT), BM_SETCHECK,
bCacheDuringMultipleMount ? BST_CHECKED:BST_UNCHECKED, 0); bCacheDuringMultipleMount ? BST_CHECKED:BST_UNCHECKED, 0);
@ -3183,6 +3189,7 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
bExplore = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_OPEN_EXPLORER)); bExplore = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_OPEN_EXPLORER));
bUseDifferentTrayIconIfVolMounted = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_USE_DIFF_TRAY_ICON_IF_VOL_MOUNTED)); bUseDifferentTrayIconIfVolMounted = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_USE_DIFF_TRAY_ICON_IF_VOL_MOUNTED));
bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PRESERVE_TIMESTAMPS)); bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PRESERVE_TIMESTAMPS));
bShowDisconnectedNetworkDrives = IsButtonChecked (GetDlgItem (hwndDlg, IDC_SHOW_DISCONNECTED_NETWORK_DRIVES));
bCacheDuringMultipleMount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT)); bCacheDuringMultipleMount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT));
bWipeCacheOnExit = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_WIPE_CACHE_ON_EXIT)); bWipeCacheOnExit = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_WIPE_CACHE_ON_EXIT));
bWipeCacheOnAutoDismount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT)); bWipeCacheOnAutoDismount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT));
@ -5830,7 +5837,7 @@ static BOOL CheckMountList (HWND hwndDlg, BOOL bForceTaskBarUpdate)
return TRUE; return TRUE;
} }
if (LastKnownLogicalDrives != GetLogicalDrives() if (LastKnownLogicalDrives != GetUsedLogicalDrives()
|| memcmp (&LastKnownMountList, &current, sizeof (current)) != 0) || memcmp (&LastKnownMountList, &current, sizeof (current)) != 0)
{ {
wchar_t selDrive; wchar_t selDrive;
@ -6188,6 +6195,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
// Set critical default options in case UsePreferences is false // Set critical default options in case UsePreferences is false
bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = TRUE; bPreserveTimestamp = defaultMountOptions.PreserveTimestamp = TRUE;
bShowDisconnectedNetworkDrives = FALSE;
ResetWrongPwdRetryCount (); ResetWrongPwdRetryCount ();
@ -7006,7 +7014,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
for (i = 0; i < 26; i++) for (i = 0; i < 26; i++)
{ {
if ((vol->dbcv_unitmask & (1 << i)) && !(GetLogicalDrives() & (1 << i))) if ((vol->dbcv_unitmask & (1 << i)) && !(GetUsedLogicalDrives() & (1 << i)))
{ {
for (m = 0; m < 26; m++) for (m = 0; m < 26; m++)
{ {
@ -7891,7 +7899,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (lw == IDM_REFRESH_DRIVE_LETTERS) if (lw == IDM_REFRESH_DRIVE_LETTERS)
{ {
DWORD driveMap = GetLogicalDrives (); DWORD driveMap = GetUsedLogicalDrives ();
WaitCursor (); WaitCursor ();

View File

@ -41,7 +41,7 @@ IDR_MOUNT_TLB TYPELIB "Mount.tlb"
// Dialog // Dialog
// //
IDD_PREFERENCES_DLG DIALOGEX 0, 0, 336, 305 IDD_PREFERENCES_DLG DIALOGEX 0, 0, 336, 316
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "VeraCrypt - Preferences" CAPTION "VeraCrypt - Preferences"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
@ -58,10 +58,12 @@ BEGIN
CONTROL "Mount all device-hosted VeraCrypt volumes",IDC_PREF_LOGON_MOUNT_DEVICES, CONTROL "Mount all device-hosted VeraCrypt volumes",IDC_PREF_LOGON_MOUNT_DEVICES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,75,188,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,75,188,10
CONTROL "User logs off",IDC_PREF_DISMOUNT_LOGOFF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,81,104,114,11 CONTROL "User logs off",IDC_PREF_DISMOUNT_LOGOFF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,81,104,114,11
CONTROL "Entering power saving mode",IDC_PREF_DISMOUNT_POWERSAVING, CONTROL "User session locked",IDC_PREF_DISMOUNT_SESSION_LOCKED,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,197,115,130,11 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,197,105,130,11
CONTROL "Screen saver is launched",IDC_PREF_DISMOUNT_SCREENSAVER, CONTROL "Screen saver is launched",IDC_PREF_DISMOUNT_SCREENSAVER,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,81,116,114,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,81,116,114,10
CONTROL "Entering power saving mode",IDC_PREF_DISMOUNT_POWERSAVING,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,197,115,130,11
CONTROL "Auto-dismount volume after no data has been read/written to it for",IDC_PREF_DISMOUNT_INACTIVE, CONTROL "Auto-dismount volume after no data has been read/written to it for",IDC_PREF_DISMOUNT_INACTIVE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,128,246,11 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,128,246,11
EDITTEXT IDC_PREF_DISMOUNT_INACTIVE_TIME,258,127,27,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT EDITTEXT IDC_PREF_DISMOUNT_INACTIVE_TIME,258,127,27,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
@ -73,29 +75,29 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,184,314,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,184,314,10
CONTROL "Preserve modification timestamp of file containers",IDC_PRESERVE_TIMESTAMPS, CONTROL "Preserve modification timestamp of file containers",IDC_PRESERVE_TIMESTAMPS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,196,316,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,196,316,10
CONTROL "Make disconnected network drives available for mounting",IDC_SHOW_DISCONNECTED_NETWORK_DRIVES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,208,316,10
CONTROL "Cache passwords in driver memory",IDC_PREF_CACHE_PASSWORDS, CONTROL "Cache passwords in driver memory",IDC_PREF_CACHE_PASSWORDS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,227,146,11 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,238,146,11
CONTROL "Wipe cached passwords on exit",IDC_PREF_WIPE_CACHE_ON_EXIT, CONTROL "Wipe cached passwords on exit",IDC_PREF_WIPE_CACHE_ON_EXIT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,227,165,11 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,238,165,11
CONTROL "Temporary Cache password during ""Mount Favorite Volumes"" operations",IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,252,294,11
CONTROL "Wipe cached passwords on auto-dismount",IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT, CONTROL "Wipe cached passwords on auto-dismount",IDC_PREF_WIPE_CACHE_ON_AUTODISMOUNT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,255,296,11 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,266,296,11
PUSHBUTTON "More Settings...",IDC_MORE_SETTINGS,5,289,85,14 CONTROL "Include PIM when caching a password",IDC_PREF_CACHE_PIM,
DEFPUSHBUTTON "OK",IDOK,225,289,50,14 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,280,296,10
PUSHBUTTON "Cancel",IDCANCEL,281,289,50,14 PUSHBUTTON "More Settings...",IDC_MORE_SETTINGS,5,300,85,14
GROUPBOX "Windows",IDT_WINDOWS_RELATED_SETTING,4,160,328,52 DEFPUSHBUTTON "OK",IDOK,225,300,50,14
PUSHBUTTON "Cancel",IDCANCEL,281,300,50,14
GROUPBOX "Windows",IDT_WINDOWS_RELATED_SETTING,4,160,328,62
GROUPBOX "Default Mount Options",IDT_DEFAULT_MOUNT_OPTIONS,4,3,328,26 GROUPBOX "Default Mount Options",IDT_DEFAULT_MOUNT_OPTIONS,4,3,328,26
GROUPBOX "VeraCrypt Background Task",IDT_TASKBAR_ICON,4,33,328,26 GROUPBOX "VeraCrypt Background Task",IDT_TASKBAR_ICON,4,33,328,26
GROUPBOX "Auto-Dismount",IDT_AUTO_DISMOUNT,4,94,328,62 GROUPBOX "Auto-Dismount",IDT_AUTO_DISMOUNT,4,94,328,62
LTEXT "minutes",IDT_MINUTES,289,129,39,10 LTEXT "minutes",IDT_MINUTES,289,129,39,10
LTEXT "Dismount all when:",IDT_AUTO_DISMOUNT_ON,9,110,71,17 LTEXT "Dismount all when:",IDT_AUTO_DISMOUNT_ON,9,110,71,17
GROUPBOX "Password Cache",IDT_PW_CACHE_OPTIONS,4,216,328,68 GROUPBOX "Password Cache",IDT_PW_CACHE_OPTIONS,4,227,328,68
GROUPBOX "Actions to perform upon logon to Windows",IDT_LOGON,4,63,328,28 GROUPBOX "Actions to perform upon logon to Windows",IDT_LOGON,4,63,328,28
CONTROL "User session locked",IDC_PREF_DISMOUNT_SESSION_LOCKED,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,197,105,130,11
CONTROL "Temporary Cache password during ""Mount Favorite Volumes"" operations",IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,241,294,11
CONTROL "Include PIM when caching a password",IDC_PREF_CACHE_PIM,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,269,296,10
END END
IDD_VOLUME_PROPERTIES DIALOGEX 60, 30, 284, 224 IDD_VOLUME_PROPERTIES DIALOGEX 60, 30, 284, 224
@ -390,7 +392,7 @@ BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 329 RIGHTMARGIN, 329
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 303 BOTTOMMARGIN, 314
END END
IDD_VOLUME_PROPERTIES, DIALOG IDD_VOLUME_PROPERTIES, DIALOG

View File

@ -74,11 +74,12 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="..\Crypto\Debug\crypto.lib" AdditionalDependencies="..\Crypto\Debug\crypto.lib mpr.lib"
OutputFile="$(OutDir)/VeraCrypt.exe" OutputFile="$(OutDir)/VeraCrypt.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
DelayLoadDLLs="mpr.dll"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/Mount.pdb" ProgramDatabaseFile="$(OutDir)/Mount.pdb"
SubSystem="2" SubSystem="2"
@ -166,11 +167,12 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="..\Crypto\x64\Debug\crypto.lib" AdditionalDependencies="..\Crypto\x64\Debug\crypto.lib mpr.lib"
OutputFile="$(OutDir)/VeraCrypt.exe" OutputFile="$(OutDir)/VeraCrypt.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
DelayLoadDLLs="mpr.dll"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/Mount.pdb" ProgramDatabaseFile="$(OutDir)/Mount.pdb"
SubSystem="2" SubSystem="2"
@ -254,11 +256,12 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="..\Crypto\Release\crypto.lib" AdditionalDependencies="..\Crypto\Release\crypto.lib mpr.lib"
OutputFile="$(OutDir)/VeraCrypt.exe" OutputFile="$(OutDir)/VeraCrypt.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
DelayLoadDLLs="mpr.dll"
GenerateDebugInformation="false" GenerateDebugInformation="false"
GenerateMapFile="true" GenerateMapFile="true"
SubSystem="2" SubSystem="2"
@ -345,11 +348,12 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="..\Crypto\x64\Release\crypto.lib" AdditionalDependencies="..\Crypto\x64\Release\crypto.lib mpr.lib"
OutputFile="$(OutDir)/VeraCrypt.exe" OutputFile="$(OutDir)/VeraCrypt.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
DelayLoadDLLs="mpr.dll"
GenerateDebugInformation="false" GenerateDebugInformation="false"
GenerateMapFile="true" GenerateMapFile="true"
SubSystem="2" SubSystem="2"

View File

@ -175,6 +175,7 @@
#define IDT_WIPE_MODE 1153 #define IDT_WIPE_MODE 1153
#define IDC_PREF_CACHE_PIM 1154 #define IDC_PREF_CACHE_PIM 1154
#define IDC_BOOT_LOADER_CACHE_PIM 1155 #define IDC_BOOT_LOADER_CACHE_PIM 1155
#define IDC_SHOW_DISCONNECTED_NETWORK_DRIVES 1156
#define IDM_HELP 40001 #define IDM_HELP 40001
#define IDM_ABOUT 40002 #define IDM_ABOUT 40002
#define IDM_UNMOUNT_VOLUME 40003 #define IDM_UNMOUNT_VOLUME 40003
@ -251,7 +252,7 @@
#define _APS_NO_MFC 1 #define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 119 #define _APS_NEXT_RESOURCE_VALUE 119
#define _APS_NEXT_COMMAND_VALUE 40069 #define _APS_NEXT_COMMAND_VALUE 40069
#define _APS_NEXT_CONTROL_VALUE 1156 #define _APS_NEXT_CONTROL_VALUE 1157
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View File

@ -65,12 +65,12 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/NODEFAULTLIB:LIBCMTD" AdditionalOptions="/NODEFAULTLIB:LIBCMTD"
AdditionalDependencies="libcmtd.lib" AdditionalDependencies="libcmtd.lib mpr.lib"
OutputFile="$(OutDir)/VeraCryptSetup.exe" OutputFile="$(OutDir)/VeraCryptSetup.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
UACExecutionLevel="2" UACExecutionLevel="2"
DelayLoadDLLs="user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll" DelayLoadDLLs="user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;mpr.dll"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/Setup.pdb" ProgramDatabaseFile="$(OutDir)/Setup.pdb"
SubSystem="2" SubSystem="2"
@ -153,11 +153,12 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/IGNORE:4089" AdditionalOptions="/IGNORE:4089"
AdditionalDependencies="mpr.lib"
OutputFile="$(OutDir)/VeraCryptSetup.exe" OutputFile="$(OutDir)/VeraCryptSetup.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
UACExecutionLevel="2" UACExecutionLevel="2"
DelayLoadDLLs="user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll" DelayLoadDLLs="user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;mpr.dll"
GenerateDebugInformation="false" GenerateDebugInformation="false"
GenerateMapFile="true" GenerateMapFile="true"
SubSystem="2" SubSystem="2"