VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mount')
-rw-r--r--src/Mount/Favorites.cpp10
-rw-r--r--src/Mount/Mount.c177
2 files changed, 96 insertions, 91 deletions
diff --git a/src/Mount/Favorites.cpp b/src/Mount/Favorites.cpp
index de4d5a08..c829128f 100644
--- a/src/Mount/Favorites.cpp
+++ b/src/Mount/Favorites.cpp
@@ -454,4 +454,4 @@ namespace VeraCrypt
HDC hdc = (HDC) wParam;
- HWND hw = (HWND) lParam;
- if (hw == GetDlgItem(hwndDlg, IDC_FAVORITE_VOLUME_ID))
+ HWND hwnd = (HWND) lParam;
+ if (hwnd == GetDlgItem(hwndDlg, IDC_FAVORITE_VOLUME_ID))
{
@@ -460,3 +460,3 @@ namespace VeraCrypt
::SelectObject(hdc, hbr);
- return (BOOL) hbr;
+ return (BOOL)(INT_PTR)hbr;
}
@@ -733,3 +733,3 @@ namespace VeraCrypt
- foreach (const FavoriteVolume favorite, FavoriteVolumes)
+ for (const FavoriteVolume favorite: FavoriteVolumes)
{
@@ -743,3 +743,3 @@ namespace VeraCrypt
- foreach (const FavoriteVolume favoriteConnected, FavoritesMountedOnArrivalStillConnected)
+ for (const FavoriteVolume favoriteConnected: FavoritesMountedOnArrivalStillConnected)
{
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 6ae6e417..09f43b88 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -177,3 +177,3 @@ KeyFile *FirstCmdKeyFile = NULL;
HBITMAP hbmLogoBitmapRescaled = NULL;
-wchar_t OrigKeyboardLayout [8+1] = L"00000409";
+wchar_t OrigKeyboardLayout [KL_NAMELENGTH] = L"00000409";
BOOL bKeyboardLayoutChanged = FALSE; /* TRUE if the keyboard layout was changed to the standard US keyboard layout (from any other layout). */
@@ -1722,3 +1722,3 @@ static void LaunchVolExpander (HWND hwndDlg)
Error ("VOL_EXPANDER_NOT_FOUND", hwndDlg); // Display a user-friendly error message and advise what to do
- else if (((int)ShellExecuteW (NULL, (!IsAdmin() && IsUacSupported()) ? L"runas" : L"open", t, NULL, NULL, SW_SHOW)) <= 32)
+ else if (((INT_PTR)ShellExecuteW (NULL, (!IsAdmin() && IsUacSupported()) ? L"runas" : L"open", t, NULL, NULL, SW_SHOW)) <= 32)
{
@@ -2047,8 +2047,8 @@ void LoadDriveLetters (HWND hwndDlg, HWND hTree, int drive)
{
- wchar_t szTmp[4096];
+ wchar_t szMsgTmp[4096];
VolumeNotificationsList.bHidVolDamagePrevReported[i] = TRUE;
- StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("DAMAGE_TO_HIDDEN_VOLUME_PREVENTED"), i+L'A');
+ StringCbPrintfW (szMsgTmp, sizeof(szMsgTmp), GetString ("DAMAGE_TO_HIDDEN_VOLUME_PREVENTED"), i+L'A');
SetForegroundWindow (GetParent(hTree));
- MessageBoxW (GetParent(hTree), szTmp, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
+ MessageBoxW (GetParent(hTree), szMsgTmp, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
}
@@ -2441,5 +2441,5 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
- if ((DWORD) GetKeyboardLayout (NULL) != 0x00000409 && (DWORD) GetKeyboardLayout (NULL) != 0x04090409)
+ if ((DWORD)(DWORD_PTR)GetKeyboardLayout (NULL) != 0x00000409 && (DWORD)(DWORD_PTR)GetKeyboardLayout (NULL) != 0x04090409)
{
- DWORD keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
+ DWORD keybLayout = (DWORD)(DWORD_PTR)LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
@@ -2498,3 +2498,3 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
- DWORD keybLayout = (DWORD) GetKeyboardLayout (NULL);
+ DWORD keybLayout = (DWORD)(DWORD_PTR)GetKeyboardLayout (NULL);
@@ -2518,3 +2518,3 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
- keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
+ keybLayout = (DWORD)(DWORD_PTR)LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
@@ -2567,3 +2567,3 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
// NOTE: per documentation as pointed out by selbie, GetSolidBrush would leak a GDI handle.
- return (BOOL)GetSysColorBrush(COLOR_MENU);
+ return (BOOL)(INT_PTR)GetSysColorBrush(COLOR_MENU);
}
@@ -2753,3 +2753,3 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
- int new_hash_algo_id = DEFAULT_HASH_ALGORITHM_BOOT;
+ new_hash_algo_id = DEFAULT_HASH_ALGORITHM_BOOT;
Info ("ALGO_NOT_SUPPORTED_FOR_SYS_ENCRYPTION", hwndDlg);
@@ -3117,5 +3117,8 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
- StringCbPrintfW (OrigKeyboardLayout, sizeof(OrigKeyboardLayout),L"%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF);
+ if (!GetKeyboardLayoutNameW(OrigKeyboardLayout))
+ {
+ StringCbPrintfW(OrigKeyboardLayout, sizeof(OrigKeyboardLayout), L"%08X", (DWORD)(DWORD_PTR)GetKeyboardLayout(NULL) & 0xFFFF);
+ }
- DWORD keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
+ DWORD keybLayout = (DWORD) (DWORD_PTR) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
@@ -3175,3 +3178,3 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
{
- DWORD keybLayout = (DWORD) GetKeyboardLayout (NULL);
+ DWORD keybLayout = (DWORD)(DWORD_PTR)GetKeyboardLayout (NULL);
@@ -3188,3 +3191,3 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
- keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
+ keybLayout = (DWORD)(DWORD_PTR) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
@@ -3641,3 +3644,3 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
{
- static MountOptions *mountOptions;
+ static MountOptions *pMountOptions;
@@ -3651,3 +3654,3 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
- mountOptions = (MountOptions *) lParam;
+ pMountOptions = (MountOptions *) lParam;
@@ -3656,12 +3659,12 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SendDlgItemMessage (hwndDlg, IDC_MOUNT_READONLY, BM_SETCHECK,
- mountOptions->ReadOnly ? BST_CHECKED : BST_UNCHECKED, 0);
+ pMountOptions->ReadOnly ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage (hwndDlg, IDC_MOUNT_REMOVABLE, BM_SETCHECK,
- mountOptions->Removable ? BST_CHECKED : BST_UNCHECKED, 0);
+ pMountOptions->Removable ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage (hwndDlg, IDC_DISABLE_MOUNT_MANAGER, BM_SETCHECK,
- mountOptions->DisableMountManager ? BST_CHECKED : BST_UNCHECKED, 0);
+ pMountOptions->DisableMountManager ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage (hwndDlg, IDC_PROTECT_HIDDEN_VOL, BM_SETCHECK,
- mountOptions->ProtectHiddenVolume ? BST_CHECKED : BST_UNCHECKED, 0);
+ pMountOptions->ProtectHiddenVolume ? BST_CHECKED : BST_UNCHECKED, 0);
- mountOptions->PartitionInInactiveSysEncScope = bPrebootPasswordDlgMode;
+ pMountOptions->PartitionInInactiveSysEncScope = bPrebootPasswordDlgMode;
@@ -3671,3 +3674,3 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SendDlgItemMessage (hwndDlg, IDC_USE_EMBEDDED_HEADER_BAK, BM_SETCHECK,
- mountOptions->UseBackupHeader ? BST_CHECKED : BST_UNCHECKED, 0);
+ pMountOptions->UseBackupHeader ? BST_CHECKED : BST_UNCHECKED, 0);
@@ -3675,3 +3678,3 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
- SetDlgItemTextW (hwndDlg, IDC_VOLUME_LABEL, mountOptions->Label);
+ SetDlgItemTextW (hwndDlg, IDC_VOLUME_LABEL, pMountOptions->Label);
SendDlgItemMessage (hwndDlg, IDC_VOLUME_LABEL, EM_LIMITTEXT, 32, 0); // 32 is the maximum possible length for a drive label in Windows
@@ -3694,3 +3697,3 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
/* if a PRF was selected previously, select it */
- if (i == mountOptions->ProtectedHidVolPkcs5Prf)
+ if (i == pMountOptions->ProtectedHidVolPkcs5Prf)
nSelectedIndex = nIndex;
@@ -3721,6 +3724,6 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
- if (mountOptions->ProtectedHidVolPassword.Length > 0)
+ if (pMountOptions->ProtectedHidVolPassword.Length > 0)
{
wchar_t szTmp[MAX_PASSWORD + 1];
- if (0 == MultiByteToWideChar (CP_UTF8, 0, (LPSTR) mountOptions->ProtectedHidVolPassword.Text, -1, szTmp, MAX_PASSWORD + 1))
+ if (0 == MultiByteToWideChar (CP_UTF8, 0, (LPSTR) pMountOptions->ProtectedHidVolPassword.Text, -1, szTmp, MAX_PASSWORD + 1))
szTmp [0] = 0;
@@ -3730,6 +3733,6 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
- SetPim (hwndDlg, IDC_PIM, mountOptions->ProtectedHidVolPim);
+ SetPim (hwndDlg, IDC_PIM, pMountOptions->ProtectedHidVolPim);
/* make PIM field visible if a PIM value has been explicitely specified */
- if (mountOptions->ProtectedHidVolPim > 0)
+ if (pMountOptions->ProtectedHidVolPim > 0)
{
@@ -3837,12 +3840,12 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
- mountOptions->ReadOnly = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_READONLY));
- mountOptions->Removable = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_REMOVABLE));
- mountOptions->DisableMountManager = IsButtonChecked (GetDlgItem (hwndDlg, IDC_DISABLE_MOUNT_MANAGER));
- mountOptions->ProtectHiddenVolume = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PROTECT_HIDDEN_VOL));
- mountOptions->PartitionInInactiveSysEncScope = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_SYSENC_PART_WITHOUT_PBA));
- mountOptions->UseBackupHeader = IsButtonChecked (GetDlgItem (hwndDlg, IDC_USE_EMBEDDED_HEADER_BAK));
+ pMountOptions->ReadOnly = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_READONLY));
+ pMountOptions->Removable = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_REMOVABLE));
+ pMountOptions->DisableMountManager = IsButtonChecked (GetDlgItem (hwndDlg, IDC_DISABLE_MOUNT_MANAGER));
+ pMountOptions->ProtectHiddenVolume = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PROTECT_HIDDEN_VOL));
+ pMountOptions->PartitionInInactiveSysEncScope = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_SYSENC_PART_WITHOUT_PBA));
+ pMountOptions->UseBackupHeader = IsButtonChecked (GetDlgItem (hwndDlg, IDC_USE_EMBEDDED_HEADER_BAK));
- GetDlgItemTextW (hwndDlg, IDC_VOLUME_LABEL, mountOptions->Label, sizeof (mountOptions->Label) /sizeof (wchar_t));
+ GetDlgItemTextW (hwndDlg, IDC_VOLUME_LABEL, pMountOptions->Label, sizeof (pMountOptions->Label) /sizeof (wchar_t));
- if (mountOptions->ProtectHiddenVolume)
+ if (pMountOptions->ProtectHiddenVolume)
{
@@ -3850,11 +3853,11 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
GetPassword (hwndDlg, IDC_PASSWORD_PROT_HIDVOL,
- (LPSTR) mountOptions->ProtectedHidVolPassword.Text, iMaxPasswordLength + 1,
+ (LPSTR) pMountOptions->ProtectedHidVolPassword.Text, iMaxPasswordLength + 1,
FALSE, FALSE);
- mountOptions->ProtectedHidVolPassword.Length = (unsigned __int32) strlen ((char *) mountOptions->ProtectedHidVolPassword.Text);
+ pMountOptions->ProtectedHidVolPassword.Length = (unsigned __int32) strlen ((char *) pMountOptions->ProtectedHidVolPassword.Text);
- mountOptions->ProtectedHidVolPkcs5Prf = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA,
+ pMountOptions->ProtectedHidVolPkcs5Prf = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA,
SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
- mountOptions->ProtectedHidVolPim = GetPim (hwndDlg, IDC_PIM, 0);
+ pMountOptions->ProtectedHidVolPim = GetPim (hwndDlg, IDC_PIM, 0);
}
@@ -3866,3 +3869,3 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
- if ((mountOptions->ProtectHiddenVolume && !bEnableBkgTask)
+ if ((pMountOptions->ProtectHiddenVolume && !bEnableBkgTask)
&& (AskWarnYesNo ("HIDVOL_PROT_BKG_TASK_WARNING", hwndDlg) == IDYES))
@@ -4481,3 +4484,3 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
::SelectObject(hdc, hbr);
- return (BOOL) hbr;
+ return (BOOL)(INT_PTR)hbr;
}
@@ -4547,3 +4550,3 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
- BOOL copyWizard, copyExpander, bExplore, bCacheInDriver, bIncludePimInCache, bAutoRun, bAutoMount, bMountReadOnly;
+ BOOL copyWizard, copyExpander, openExplorer, cacheInDriver, includePimInCache, bAutoRun, bAutoMount, bMountReadOnly;
WCHAR dstDir[MAX_PATH + 1];
@@ -4565,5 +4568,5 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
copyExpander = IsButtonChecked (GetDlgItem (hwndDlg, IDC_COPY_EXPANDER));
- bExplore = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAVEL_OPEN_EXPLORER));
- bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAV_CACHE_PASSWORDS));
- bIncludePimInCache = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_CACHE_PIM));
+ openExplorer = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAVEL_OPEN_EXPLORER));
+ cacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAV_CACHE_PASSWORDS));
+ includePimInCache = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_CACHE_PIM));
bMountReadOnly = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_READONLY));
@@ -4980,4 +4983,4 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
drive > 0 ? driveLetter : L"",
- bExplore ? L" /e" : L"",
- bCacheInDriver ? (bIncludePimInCache? L" /c p" : L" /c y") : L"",
+ openExplorer ? L" /e" : L"",
+ cacheInDriver ? (includePimInCache? L" /c p" : L" /c y") : L"",
bMountReadOnly ? L" /m ro" : L"",
@@ -5163,3 +5166,3 @@ static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int
-static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim, int pkcs5)
+static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szVolFileName, int pim, int pkcs5)
{
@@ -5195,3 +5198,3 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
- if (szFileName == NULL)
+ if (szVolFileName == NULL)
{
@@ -5200,3 +5203,3 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
else
- StringCchCopyW (fileName, ARRAYSIZE (fileName), szFileName);
+ StringCchCopyW (fileName, ARRAYSIZE (fileName), szVolFileName);
@@ -5214,5 +5217,5 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
- szFileName = fileName;
+ szVolFileName = fileName;
- if (IsMountedVolume (szFileName))
+ if (IsMountedVolume (szVolFileName))
{
@@ -5223,3 +5226,3 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
- if (!VolumePathExists (szFileName))
+ if (!VolumePathExists (szVolFileName))
{
@@ -5239,3 +5242,3 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
// First try cached passwords and if they fail ask user for a new one
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, EffectiveVolumePkcs5, EffectiveVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szVolFileName, NULL, EffectiveVolumePkcs5, EffectiveVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
@@ -5246,5 +5249,5 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
- KeyFilesApply (hwndDlg, &emptyPassword, FirstKeyFile, szFileName);
+ KeyFilesApply (hwndDlg, &emptyPassword, FirstKeyFile, szVolFileName);
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, EffectiveVolumePkcs5, EffectiveVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szVolFileName, &emptyPassword, EffectiveVolumePkcs5, EffectiveVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
@@ -5258,3 +5261,3 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
// if no PIM specified for favorite, we use also the PIM of the previous volume alongside its password.
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, EffectiveVolumePkcs5, (EffectiveVolumePim < 0)? VolumePim : EffectiveVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szVolFileName, &VolumePassword, EffectiveVolumePkcs5, (EffectiveVolumePim < 0)? VolumePim : EffectiveVolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, FALSE);
}
@@ -5267,3 +5270,3 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
// Check for problematic file extensions (exe, dll, sys)
- if (CheckFileExtension(szFileName))
+ if (CheckFileExtension(szVolFileName))
Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING", hwndDlg);
@@ -5283,3 +5286,3 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
int GuiPim = EffectiveVolumePim;
- StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), szFileName);
+ StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), szVolFileName);
@@ -5299,5 +5302,5 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
if (KeyFilesEnable)
- KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile, szFileName);
+ KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile, szVolFileName);
- mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, !Silent);
+ mounted = MountVolume (hwndDlg, nDosDriveNo, szVolFileName, &VolumePassword, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, Silent, !Silent);
NormalCursor ();
@@ -5305,3 +5308,3 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, wchar_t *szFileName, int pim,
// Check for problematic file extensions (exe, dll, sys)
- if (mounted > 0 && CheckFileExtension (szFileName))
+ if (mounted > 0 && CheckFileExtension (szVolFileName))
Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING", hwndDlg);
@@ -5593,3 +5596,3 @@ retry:
{
- wchar_t root[] = { (wchar_t) i + L'A', L':', L'\\', 0 };
+ wchar_t root[] = { (wchar_t) (i + L'A'), L':', L'\\', 0 };
SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
@@ -5685,7 +5688,7 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
- foreach (const HostDevice &device, partitions)
+ for (const HostDevice &device: partitions)
{
- wchar_t szFileName[TC_MAX_PATH];
- StringCbCopyW (szFileName, sizeof (szFileName), device.Path.c_str());
- BOOL mounted = IsMountedVolume (szFileName);
+ wchar_t szPartPath[TC_MAX_PATH];
+ StringCbCopyW (szPartPath, sizeof (szPartPath), device.Path.c_str());
+ BOOL mounted = IsMountedVolume (szPartPath);
@@ -5749,4 +5752,4 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
// First try user password then cached passwords
- if ((mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, TRUE, FALSE)) > 0
- || ((VolumePassword.Length > 0) && ((mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, TRUE, FALSE)) > 0)))
+ if ((mounted = MountVolume (hwndDlg, nDosDriveNo, szPartPath, &VolumePassword, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, TRUE, FALSE)) > 0
+ || ((VolumePassword.Length > 0) && ((mounted = MountVolume (hwndDlg, nDosDriveNo, szPartPath, NULL, VolumePkcs5, VolumePim, bCacheInDriver, bIncludePimInCache, bForceMount, &mountOptions, TRUE, FALSE)) > 0)))
{
@@ -6021,3 +6024,6 @@ static void ChangeSysEncPassword (HWND hwndDlg, BOOL bOnlyChangeKDF)
{
- StringCbPrintfW (OrigKeyboardLayout, sizeof(OrigKeyboardLayout), L"%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF);
+ if (!GetKeyboardLayoutNameW(OrigKeyboardLayout))
+ {
+ StringCbPrintfW(OrigKeyboardLayout, sizeof(OrigKeyboardLayout), L"%08X", (DWORD)(DWORD_PTR)GetKeyboardLayout(NULL) & 0xFFFF);
+ }
@@ -7682,3 +7688,3 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
- foreach (FavoriteVolume favorite, FavoritesOnArrivalMountRequired)
+ for (FavoriteVolume favorite: FavoritesOnArrivalMountRequired)
{
@@ -7732,3 +7738,3 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
bool mountedAndNotDisconnected = false;
- foreach (FavoriteVolume mountedFavorite, FavoritesMountedOnArrivalStillConnected)
+ for (FavoriteVolume mountedFavorite: FavoritesMountedOnArrivalStillConnected)
{
@@ -7987,8 +7993,8 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
- wchar_t *vol = (wchar_t *) LastKnownMountList.wszVolume[m];
+ wchar_t *wszVol = (wchar_t *) LastKnownMountList.wszVolume[m];
- if (wcsstr (vol, L"\\??\\") == vol)
+ if (wcsstr (wszVol, L"\\??\\") == wszVol)
vol += 4;
- if (vol[1] == L':' && i == (vol[0] - (vol[0] <= L'Z' ? L'A' : L'a')))
+ if (wszVol[1] == L':' && i == (wszVol[0] - (wszVol[0] <= L'Z' ? L'A' : L'a')))
{
@@ -11106,3 +11112,3 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
wchar_t szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
- wchar_t szFileName[TC_MAX_PATH];
+ wchar_t szHeaderFileName[TC_MAX_PATH];
wchar_t szDosDevice[TC_MAX_PATH];
@@ -11272,3 +11278,3 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
/* Select backup file */
- if (!BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, FALSE))
+ if (!BrowseFiles (hwndDlg, "OPEN_TITLE", szHeaderFileName, bHistory, FALSE))
{
@@ -11279,3 +11285,3 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
/* Open the backup file */
- fBackup = CreateFile (szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+ fBackup = CreateFile (szHeaderFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (fBackup == INVALID_HANDLE_VALUE)
@@ -11415,3 +11421,2 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
- LARGE_INTEGER headerOffset;
LARGE_INTEGER headerBackupOffset;
@@ -11732,3 +11737,3 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
BOOL allowWindowsDefrag = IsDlgButtonChecked (hwndDlg, IDC_ALLOW_WINDOWS_DEFRAG);
- BOOL bDisableMemoryProtection = IsDlgButtonChecked (hwndDlg, IDC_DISABLE_MEMORY_PROTECTION);
+ BOOL disableMemoryProtection = IsDlgButtonChecked (hwndDlg, IDC_DISABLE_MEMORY_PROTECTION);
@@ -11802,5 +11807,5 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
BOOL originalDisableMemoryProtection = !ReadMemoryProtectionConfig();
- if(originalDisableMemoryProtection != bDisableMemoryProtection)
+ if(originalDisableMemoryProtection != disableMemoryProtection)
rebootRequired = true;
- SetMemoryProtectionConfig (!bDisableMemoryProtection);
+ SetMemoryProtectionConfig (!disableMemoryProtection);
@@ -12162,4 +12167,4 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
{
- BootEncryptionStatus BootEncStatus = BootEncObj->GetStatus();
- if (!BootEncStatus.DriveMounted)
+ BootEncryptionStatus bootEncStatus = BootEncObj->GetStatus();
+ if (!bootEncStatus.DriveMounted)
{