diff options
Diffstat (limited to 'src/Mount')
-rw-r--r-- | src/Mount/Favorites.cpp | 4 | ||||
-rw-r--r-- | src/Mount/Hotkeys.c | 94 | ||||
-rw-r--r-- | src/Mount/Mount.c | 290 | ||||
-rw-r--r-- | src/Mount/Mount.h | 4 |
4 files changed, 212 insertions, 180 deletions
diff --git a/src/Mount/Favorites.cpp b/src/Mount/Favorites.cpp index 06c1aa32..93d9c648 100644 --- a/src/Mount/Favorites.cpp +++ b/src/Mount/Favorites.cpp @@ -39,41 +39,41 @@ namespace VeraCrypt if (!DeviceIoControl (hDriver, TC_IOCTL_GET_VOLUME_PROPERTIES, &prop, sizeof (prop), &prop, sizeof (prop), &bytesReturned, NULL))
{
handleWin32Error (hwndDlg);
return FALSE;
}
FavoriteVolume favorite;
favorite.MountPoint = "X:\\";
favorite.MountPoint[0] = (char) (prop.driveNo + 'A');
favorite.Path = WideToSingleString ((wchar_t *) prop.wszVolume);
if (favorite.Path.find ("\\??\\") == 0)
favorite.Path = favorite.Path.substr (4);
if (IsVolumeDeviceHosted (favorite.Path.c_str()))
{
// Get GUID path
string volumeDevPath = favorite.Path;
wchar_t resolvedVolumeDevPath[TC_MAX_PATH];
- if (ResolveSymbolicLink (SingleStringToWide (volumeDevPath).c_str(), resolvedVolumeDevPath))
+ if (ResolveSymbolicLink (SingleStringToWide (volumeDevPath).c_str(), resolvedVolumeDevPath, sizeof(resolvedVolumeDevPath)))
volumeDevPath = WideToSingleString (resolvedVolumeDevPath);
char volumeName[TC_MAX_PATH];
HANDLE find = FindFirstVolume (volumeName, sizeof (volumeName));
if (find != INVALID_HANDLE_VALUE)
{
do
{
char findVolumeDevPath[TC_MAX_PATH];
string vn = volumeName;
if (QueryDosDevice (vn.substr (4, vn.size() - 5).c_str(), findVolumeDevPath, sizeof (findVolumeDevPath)) != 0
&& volumeDevPath == findVolumeDevPath)
{
favorite.VolumePathId = volumeName;
break;
}
} while (FindNextVolume (find, volumeName, sizeof (volumeName)));
@@ -397,41 +397,41 @@ namespace VeraCrypt return 1;
}
break;
case WM_CLOSE:
EndDialog (hwndDlg, IDCLOSE);
return 1;
}
return 0;
}
static void FillFavoriteVolumesMenu ()
{
while (DeleteMenu (FavoriteVolumesMenu, 7, MF_BYPOSITION)) { }
if (FavoriteVolumes.empty())
return;
- AppendMenu (FavoriteVolumesMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenu (FavoriteVolumesMenu, MF_SEPARATOR, 0, "");
int i = 0;
foreach (const FavoriteVolume &favorite, FavoriteVolumes)
{
UINT flags = MF_STRING;
if (favorite.DisconnectedDevice)
flags |= MF_GRAYED;
wstring menuText = SingleStringToWide (favorite.Path);
if (favorite.DisconnectedDevice)
menuText = favorite.Label.empty() ? wstring (L"(") + GetString ("FAVORITE_DISCONNECTED_DEV") + L")" : L"";
if (!favorite.Label.empty())
{
if (favorite.DisconnectedDevice)
menuText = favorite.Label + L" " + menuText;
else
menuText = favorite.Label;
}
diff --git a/src/Mount/Hotkeys.c b/src/Mount/Hotkeys.c index 96f9abcd..c0829602 100644 --- a/src/Mount/Hotkeys.c +++ b/src/Mount/Hotkeys.c @@ -1,135 +1,137 @@ /*
Copyright (c) 2005 TrueCrypt Developers Association. All rights reserved.
Governed by the TrueCrypt License 3.0 the full text of which is contained in
the file License.txt included in TrueCrypt binary and source code distribution
packages.
*/
#include <windows.h>
#include "Dlgcode.h"
#include "Hotkeys.h"
#include "Language.h"
#include "Mount.h"
#include "Resource.h"
+#include <Strsafe.h>
+
#define MAX_KEY_COMB_NAME_LEN 260
TCHOTKEY Hotkeys [NBR_HOTKEYS];
static TCHOTKEY tmpHotkeys [NBR_HOTKEYS];
static int nSelectedHotkeyId;
static UINT currentVKeyCode;
static void ScanAndProcessKey (UINT *vKeyCode, wchar_t *keyName)
{
UINT vKey;
*vKeyCode = 0;
for (vKey = 0; vKey <= 0xFF; vKey++)
{
if (GetAsyncKeyState (vKey) < 0)
{
if (GetKeyName (vKey, keyName)) // If the key is allowed and its name has been resolved
*vKeyCode = vKey;
}
}
}
/* Returns TRUE if the key is allowed and its name is resolved. */
BOOL GetKeyName (UINT vKey, wchar_t *keyName)
{
BOOL result = TRUE;
if (vKey >= 0x30 && vKey <= 0x5a)
{
// ASCII characters
- wsprintfW (keyName, L"%hc", (char) vKey);
+ StringCbPrintfW (keyName, MAX_KEY_COMB_NAME_LEN, L"%hc", (char) vKey);
}
else if (vKey >= 0xE9 && vKey <= 0xF5)
{
// OEM-specific
- wsprintfW (keyName, L"OEM-%d", vKey);
+ StringCbPrintfW (keyName, MAX_KEY_COMB_NAME_LEN, L"OEM-%d", vKey);
}
else if (vKey >= VK_F1 && vKey <= VK_F24)
{
// F1-F24
- wsprintfW (keyName, L"F%d", vKey - VK_F1 + 1);
+ StringCbPrintfW (keyName, MAX_KEY_COMB_NAME_LEN, L"F%d", vKey - VK_F1 + 1);
}
else if (vKey >= VK_NUMPAD0 && vKey <= VK_NUMPAD9)
{
// Numpad numbers
- wsprintfW (keyName, L"%s %d", GetString ("VK_NUMPAD"), vKey - VK_NUMPAD0);
+ StringCbPrintfW (keyName, MAX_KEY_COMB_NAME_LEN, L"%s %d", GetString ("VK_NUMPAD"), vKey - VK_NUMPAD0);
}
else
{
switch (vKey)
{
- case VK_MULTIPLY: wsprintfW (keyName, L"%s *", GetString ("VK_NUMPAD")); break;
- case VK_ADD: wsprintfW (keyName, L"%s +", GetString ("VK_NUMPAD")); break;
- case VK_SEPARATOR: wsprintfW (keyName, L"%s Separator", GetString ("VK_NUMPAD")); break;
- case VK_SUBTRACT: wsprintfW (keyName, L"%s -", GetString ("VK_NUMPAD")); break;
- case VK_DECIMAL: wsprintfW (keyName, L"%s .", GetString ("VK_NUMPAD")); break;
- case VK_DIVIDE: wsprintfW (keyName, L"%s /", GetString ("VK_NUMPAD")); break;
- case VK_OEM_1: wcscpy (keyName, L"OEM 1 (';')"); break;
- case VK_OEM_PLUS: wcscpy (keyName, L"+"); break;
- case VK_OEM_COMMA: wcscpy (keyName, L","); break;
- case VK_OEM_MINUS: wcscpy (keyName, L"-"); break;
- case VK_OEM_PERIOD: wcscpy (keyName, L"."); break;
- case VK_OEM_2: wcscpy (keyName, L"OEM 2 ('/')"); break;
- case VK_OEM_3: wcscpy (keyName, L"OEM 3 (`)"); break;
- case VK_OEM_4: wcscpy (keyName, L"OEM 4 ('[')"); break;
- case VK_OEM_5: wcscpy (keyName, L"OEM 5 ('\\')"); break;
- case VK_OEM_6: wcscpy (keyName, L"OEM 6 (']')"); break;
- case VK_OEM_7: wcscpy (keyName, L"OEM 7 (')"); break;
- case VK_OEM_8: wcscpy (keyName, L"OEM 8"); break;
- case VK_OEM_AX: wcscpy (keyName, L"OEM AX"); break;
- case VK_OEM_102: wcscpy (keyName, L"OEM 102"); break;
- case VK_ICO_HELP: wcscpy (keyName, L"ICO_HELP"); break;
- case VK_ICO_00: wcscpy (keyName, L"ICO_00"); break;
- case VK_ICO_CLEAR: wcscpy (keyName, L"ICO_CLEAR"); break;
- case VK_ATTN: wcscpy (keyName, L"Attn"); break;
- case VK_CRSEL: wcscpy (keyName, L"CrSel"); break;
- case VK_EXSEL: wcscpy (keyName, L"ExSel"); break;
- case VK_EREOF: wcscpy (keyName, L"Erase EOF"); break;
- case VK_PA1: wcscpy (keyName, L"PA1"); break;
- case VK_OEM_CLEAR: wcscpy (keyName, L"OEM Clear"); break;
+ case VK_MULTIPLY: StringCbPrintfW (keyName, MAX_KEY_COMB_NAME_LEN, L"%s *", GetString ("VK_NUMPAD")); break;
+ case VK_ADD: StringCbPrintfW (keyName, MAX_KEY_COMB_NAME_LEN, L"%s +", GetString ("VK_NUMPAD")); break;
+ case VK_SEPARATOR: StringCbPrintfW (keyName, MAX_KEY_COMB_NAME_LEN, L"%s Separator", GetString ("VK_NUMPAD")); break;
+ case VK_SUBTRACT: StringCbPrintfW (keyName, MAX_KEY_COMB_NAME_LEN, L"%s -", GetString ("VK_NUMPAD")); break;
+ case VK_DECIMAL: StringCbPrintfW (keyName, MAX_KEY_COMB_NAME_LEN, L"%s .", GetString ("VK_NUMPAD")); break;
+ case VK_DIVIDE: StringCbPrintfW (keyName, MAX_KEY_COMB_NAME_LEN, L"%s /", GetString ("VK_NUMPAD")); break;
+ case VK_OEM_1: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"OEM 1 (';')"); break;
+ case VK_OEM_PLUS: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"+"); break;
+ case VK_OEM_COMMA: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L","); break;
+ case VK_OEM_MINUS: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"-"); break;
+ case VK_OEM_PERIOD: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"."); break;
+ case VK_OEM_2: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"OEM 2 ('/')"); break;
+ case VK_OEM_3: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"OEM 3 (`)"); break;
+ case VK_OEM_4: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"OEM 4 ('[')"); break;
+ case VK_OEM_5: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"OEM 5 ('\\')"); break;
+ case VK_OEM_6: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"OEM 6 (']')"); break;
+ case VK_OEM_7: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"OEM 7 (')"); break;
+ case VK_OEM_8: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"OEM 8"); break;
+ case VK_OEM_AX: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"OEM AX"); break;
+ case VK_OEM_102: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"OEM 102"); break;
+ case VK_ICO_HELP: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"ICO_HELP"); break;
+ case VK_ICO_00: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"ICO_00"); break;
+ case VK_ICO_CLEAR: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"ICO_CLEAR"); break;
+ case VK_ATTN: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"Attn"); break;
+ case VK_CRSEL: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"CrSel"); break;
+ case VK_EXSEL: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"ExSel"); break;
+ case VK_EREOF: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"Erase EOF"); break;
+ case VK_PA1: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"PA1"); break;
+ case VK_OEM_CLEAR: StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, L"OEM Clear"); break;
case 0:
case 1:
case 0xFF:
result = FALSE;
break;
default:
{
char key[16];
wchar_t *desc;
- sprintf (key, "VKEY_%02X", vKey);
+ StringCbPrintfA (key, sizeof(key),"VKEY_%02X", vKey);
desc = GetString (key);
if (desc == UnknownString)
result = FALSE;
else
- wcsncpy (keyName, desc, MAX_KEY_COMB_NAME_LEN);
+ StringCbCopyW (keyName, MAX_KEY_COMB_NAME_LEN, desc);
}
}
}
return result;
}
static BOOL ShortcutInUse (UINT vKeyCode, UINT modifiers, TCHOTKEY hotkeys[])
{
int i;
for (i = 0; i < NBR_HOTKEYS; i++)
{
if (hotkeys[i].vKeyCode == vKeyCode && hotkeys[i].vKeyModifiers == modifiers)
return TRUE;
}
return FALSE;
}
@@ -209,70 +211,70 @@ static void DisplayHotkeyList (HWND hwndDlg) case HK_MOUNT_FAVORITE_VOLUMES:
item.pszText = GetString ("HK_MOUNT_FAVORITE_VOLUMES");
break;
case HK_SHOW_HIDE_MAIN_WINDOW:
item.pszText = GetString ("HK_SHOW_HIDE_MAIN_WINDOW");
break;
case HK_CLOSE_SECURITY_TOKEN_SESSIONS:
item.pszText = GetString ("IDM_CLOSE_ALL_TOKEN_SESSIONS");
break;
default:
item.pszText = L"[?]";
}
SendMessageW (hList,LVM_INSERTITEMW,0,(LPARAM)&item);
item.iSubItem = 1;
- wcscpy (Shortcut, L"");
- wcscpy (ShortcutMod, L"");
+ Shortcut[0] = 0;
+ ShortcutMod[0] = 0;
if (GetKeyName (tmpHotkeys[i].vKeyCode, Shortcut))
{
if (tmpHotkeys[i].vKeyModifiers & MOD_CONTROL)
{
- wcscat (ShortcutMod, GetString ("VK_CONTROL"));
- wcscat (ShortcutMod, L"+");
+ StringCbCatW (ShortcutMod, sizeof(ShortcutMod),GetString ("VK_CONTROL"));
+ StringCbCatW (ShortcutMod, sizeof(ShortcutMod),L"+");
}
if (tmpHotkeys[i].vKeyModifiers & MOD_SHIFT)
{
- wcscat (ShortcutMod, GetString ("VK_SHIFT"));
- wcscat (ShortcutMod, L"+");
+ StringCbCatW (ShortcutMod, sizeof(ShortcutMod),GetString ("VK_SHIFT"));
+ StringCbCatW (ShortcutMod, sizeof(ShortcutMod),L"+");
}
if (tmpHotkeys[i].vKeyModifiers & MOD_ALT)
{
- wcscat (ShortcutMod, GetString ("VK_ALT"));
- wcscat (ShortcutMod, L"+");
+ StringCbCatW (ShortcutMod, sizeof(ShortcutMod),GetString ("VK_ALT"));
+ StringCbCatW (ShortcutMod, sizeof(ShortcutMod),L"+");
}
if (tmpHotkeys[i].vKeyModifiers & MOD_WIN)
{
- wcscat (ShortcutMod, GetString ("VK_WIN"));
- wcscat (ShortcutMod, L"+");
+ StringCbCatW (ShortcutMod, sizeof(ShortcutMod),GetString ("VK_WIN"));
+ StringCbCatW (ShortcutMod, sizeof(ShortcutMod),L"+");
}
- wsprintfW (ShortcutFinal, L"%s%s", ShortcutMod, Shortcut);
+ StringCbPrintfW (ShortcutFinal, sizeof(ShortcutFinal), L"%s%s", ShortcutMod, Shortcut);
item.pszText = ShortcutFinal;
}
else
item.pszText = L"";
SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&item);
}
}
BOOL CALLBACK HotkeysDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND hList = GetDlgItem (hwndDlg, IDC_HOTKEY_LIST);
HWND hwndMainDlg = hwndDlg;
WORD lw = LOWORD (wParam);
WORD hw = HIWORD (wParam);
static BOOL bKeyScanOn;
static BOOL bTPlaySoundOnSuccessfulHkDismount;
static BOOL bTDisplayBalloonOnSuccessfulHkDismount;
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 5f6e472e..c63d31eb 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -29,40 +29,42 @@ #include "Favorites.h"
#include "Hotkeys.h"
#include "Keyfiles.h"
#include "Language.h"
#include "MainCom.h"
#include "Mount.h"
#include "Pkcs5.h"
#include "Random.h"
#include "Registry.h"
#include "Resource.h"
#include "Password.h"
#include "Xml.h"
#include "../Boot/Windows/BootCommon.h"
#include "../Common/Dictionary.h"
#include "../Common/Common.h"
#include "../Common/Resource.h"
#include "../Common/SecurityToken.h"
#include "../Platform/Finally.h"
#include "../Platform/ForEach.h"
+#include <Strsafe.h>
+
using namespace VeraCrypt;
enum timer_ids
{
TIMER_ID_MAIN = 0xff,
TIMER_ID_KEYB_LAYOUT_GUARD
};
enum hidden_os_read_only_notif_mode
{
TC_HIDDEN_OS_READ_ONLY_NOTIF_MODE_NONE = 0,
TC_HIDDEN_OS_READ_ONLY_NOTIF_MODE_COMPACT,
TC_HIDDEN_OS_READ_ONLY_NOTIF_MODE_DISABLED
};
#define TIMER_INTERVAL_MAIN 500
#define TIMER_INTERVAL_KEYB_LAYOUT_GUARD 10
BootEncryption *BootEncObj = NULL;
BootEncryptionStatus BootEncStatus;
@@ -517,41 +519,41 @@ void SaveSettings (HWND hwndDlg) ConfigWriteInt ("EnableBackgroundTask", bEnableBkgTask);
ConfigWriteInt ("CloseBackgroundTaskOnNoVolumes", bCloseBkgTaskWhenNoVolumes);
ConfigWriteInt ("DismountOnLogOff", bDismountOnLogOff);
ConfigWriteInt ("DismountOnPowerSaving", bDismountOnPowerSaving);
ConfigWriteInt ("DismountOnScreenSaver", bDismountOnScreenSaver);
ConfigWriteInt ("ForceAutoDismount", bForceAutoDismount);
ConfigWriteInt ("MaxVolumeIdleTime", MaxVolumeIdleTime);
ConfigWriteInt ("HiddenSectorDetectionStatus", HiddenSectorDetectionStatus);
ConfigWriteInt ("UseKeyfiles", defaultKeyFilesParam.EnableKeyFiles);
if (IsHiddenOSRunning())
ConfigWriteInt ("HiddenSystemLeakProtNotifStatus", HiddenSysLeakProtectionNotificationStatus);
// Drive Letter
lLetter = GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST));
if (LOWORD (lLetter) != 0xffff)
- sprintf (szTmp, "%c:", (char) HIWORD (lLetter));
+ StringCbPrintfA (szTmp, sizeof(szTmp), "%c:", (char) HIWORD (lLetter));
ConfigWriteString ("LastSelectedDrive", szTmp);
ConfigWriteInt ("CloseSecurityTokenSessionsAfterMount", CloseSecurityTokenSessionsAfterMount);
ConfigWriteInt ("DisableSystemCrashDetection", DisableSystemCrashDetection);
// Hotkeys
ConfigWriteInt ("HotkeyModAutoMountDevices", Hotkeys[HK_AUTOMOUNT_DEVICES].vKeyModifiers);
ConfigWriteInt ("HotkeyCodeAutoMountDevices", Hotkeys[HK_AUTOMOUNT_DEVICES].vKeyCode);
ConfigWriteInt ("HotkeyModDismountAll", Hotkeys[HK_DISMOUNT_ALL].vKeyModifiers);
ConfigWriteInt ("HotkeyCodeDismountAll", Hotkeys[HK_DISMOUNT_ALL].vKeyCode);
ConfigWriteInt ("HotkeyModWipeCache", Hotkeys[HK_WIPE_CACHE].vKeyModifiers);
ConfigWriteInt ("HotkeyCodeWipeCache", Hotkeys[HK_WIPE_CACHE].vKeyCode);
ConfigWriteInt ("HotkeyModDismountAllWipe", Hotkeys[HK_DISMOUNT_ALL_AND_WIPE].vKeyModifiers);
ConfigWriteInt ("HotkeyCodeDismountAllWipe", Hotkeys[HK_DISMOUNT_ALL_AND_WIPE].vKeyCode);
ConfigWriteInt ("HotkeyModForceDismountAllWipe", Hotkeys[HK_FORCE_DISMOUNT_ALL_AND_WIPE].vKeyModifiers);
ConfigWriteInt ("HotkeyCodeForceDismountAllWipe", Hotkeys[HK_FORCE_DISMOUNT_ALL_AND_WIPE].vKeyCode);
ConfigWriteInt ("HotkeyModForceDismountAllWipeExit", Hotkeys[HK_FORCE_DISMOUNT_ALL_AND_WIPE_AND_EXIT].vKeyModifiers);
ConfigWriteInt ("HotkeyCodeForceDismountAllWipeExit", Hotkeys[HK_FORCE_DISMOUNT_ALL_AND_WIPE_AND_EXIT].vKeyCode);
ConfigWriteInt ("HotkeyModMountFavoriteVolumes", Hotkeys[HK_MOUNT_FAVORITE_VOLUMES].vKeyModifiers);
ConfigWriteInt ("HotkeyCodeMountFavoriteVolumes", Hotkeys[HK_MOUNT_FAVORITE_VOLUMES].vKeyCode);
@@ -704,135 +706,135 @@ static void PopulateSysEncContextMenu (HMENU popup, BOOL bToolsOnly) try
{
BootEncStatus = BootEncObj->GetStatus();
}
catch (Exception &e)
{
e.Show (MainDlg);
}
if (!bToolsOnly && !IsHiddenOSRunning())
{
if (SysEncryptionOrDecryptionRequired ())
{
if (!BootEncStatus.SetupInProgress)
AppendMenuW (popup, MF_STRING, IDM_SYSENC_RESUME, GetString ("IDM_SYSENC_RESUME"));
if (SystemEncryptionStatus != SYSENC_STATUS_DECRYPTING)
AppendMenuW (popup, MF_STRING, IDM_PERMANENTLY_DECRYPT_SYS, GetString ("PERMANENTLY_DECRYPT"));
AppendMenuW (popup, MF_STRING, IDM_ENCRYPT_SYSTEM_DEVICE, GetString ("ENCRYPT"));
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
}
}
AppendMenuW (popup, MF_STRING, IDM_CHANGE_SYS_PASSWORD, GetString ("IDM_CHANGE_SYS_PASSWORD"));
AppendMenuW (popup, MF_STRING, IDM_CHANGE_SYS_HEADER_KEY_DERIV_ALGO, GetString ("IDM_CHANGE_SYS_HEADER_KEY_DERIV_ALGO"));
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
AppendMenuW (popup, MF_STRING, IDM_SYS_ENC_SETTINGS, GetString ("IDM_SYS_ENC_SETTINGS"));
if (!IsHiddenOSRunning())
{
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
AppendMenuW (popup, MF_STRING, IDM_CREATE_RESCUE_DISK, GetString ("IDM_CREATE_RESCUE_DISK"));
AppendMenuW (popup, MF_STRING, IDM_VERIFY_RESCUE_DISK, GetString ("IDM_VERIFY_RESCUE_DISK"));
}
if (!bToolsOnly)
{
if (SysDriveOrPartitionFullyEncrypted (FALSE) && !IsHiddenOSRunning())
{
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
AppendMenuW (popup, MF_STRING, IDM_PERMANENTLY_DECRYPT_SYS, GetString ("PERMANENTLY_DECRYPT"));
}
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
AppendMenuW (popup, MF_STRING, IDM_VOLUME_PROPERTIES, GetString ("IDPM_PROPERTIES"));
}
}
// WARNING: This function may take a long time to complete. To prevent data corruption, it MUST be called before
// mounting a partition (as a regular volume) that is within key scope of system encryption.
// Returns TRUE if the partition can be mounted as a partition within key scope of inactive system encryption.
// If devicePath is empty, the currently selected partition in the GUI is checked.
BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet)
{
BOOL tmpbDevice;
char szDevicePath [TC_MAX_PATH+1];
char szDiskFile [TC_MAX_PATH+1];
if (strlen (devicePath) < 2)
{
GetWindowText (GetDlgItem (MainDlg, IDC_VOLUME), szDevicePath, sizeof (szDevicePath));
- CreateFullVolumePath (szDiskFile, szDevicePath, &tmpbDevice);
+ CreateFullVolumePath (szDiskFile, sizeof(szDiskFile), szDevicePath, &tmpbDevice);
if (!tmpbDevice)
{
if (!quiet)
Warning ("NO_SYSENC_PARTITION_SELECTED");
return FALSE;
}
if (LOWORD (GetSelectedLong (GetDlgItem (MainDlg, IDC_DRIVELIST))) != TC_MLIST_ITEM_FREE)
{
if (!quiet)
Warning ("SELECT_FREE_DRIVE");
return FALSE;
}
}
else
- strncpy (szDevicePath, devicePath, sizeof (szDevicePath) - 1);
+ StringCbCopyA (szDevicePath, sizeof(szDevicePath), devicePath);
char *partionPortion = strrchr (szDevicePath, '\\');
if (!partionPortion
|| !_stricmp (partionPortion, "\\Partition0"))
{
// Only partitions are supported (not whole drives)
if (!quiet)
Warning ("NO_SYSENC_PARTITION_SELECTED");
return FALSE;
}
try
{
BootEncStatus = BootEncObj->GetStatus();
if (BootEncStatus.DriveMounted)
{
int retCode = 0;
int driveNo;
char parentDrivePath [TC_MAX_PATH+1];
if (sscanf (szDevicePath, "\\Device\\Harddisk%d\\Partition", &driveNo) != 1)
{
if (!quiet)
Error ("INVALID_PATH");
return FALSE;
}
- _snprintf (parentDrivePath,
+ StringCbPrintfA (parentDrivePath,
sizeof (parentDrivePath),
"\\Device\\Harddisk%d\\Partition0",
driveNo);
WaitCursor ();
// This is critical (re-mounting a mounted system volume as a normal volume could cause data corruption)
// so we force the slower but reliable method
retCode = IsSystemDevicePath (parentDrivePath, MainDlg, TRUE);
NormalCursor();
if (retCode != 2)
return TRUE;
else
{
// The partition is located on active system drive
if (!quiet)
Warning ("MOUNT_WITHOUT_PBA_VOL_ON_ACTIVE_SYSENC_DRIVE");
@@ -855,41 +857,41 @@ BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet) // Returns TRUE if the host drive of the specified partition contains a portion of the TrueCrypt Boot Loader
// and if the drive is not within key scope of active system encryption (e.g. the system drive of the running OS).
// If bPrebootPasswordDlgMode is TRUE, this function returns FALSE (because the check would be redundant).
BOOL TCBootLoaderOnInactiveSysEncDrive (void)
{
try
{
int driveNo;
char szDevicePath [TC_MAX_PATH+1];
char parentDrivePath [TC_MAX_PATH+1];
if (bPrebootPasswordDlgMode)
return FALSE;
GetWindowText (GetDlgItem (MainDlg, IDC_VOLUME), szDevicePath, sizeof (szDevicePath));
if (sscanf (szDevicePath, "\\Device\\Harddisk%d\\Partition", &driveNo) != 1)
return FALSE;
- _snprintf (parentDrivePath,
+ StringCbPrintfA (parentDrivePath,
sizeof (parentDrivePath),
"\\Device\\Harddisk%d\\Partition0",
driveNo);
BootEncStatus = BootEncObj->GetStatus();
if (BootEncStatus.DriveMounted
&& IsSystemDevicePath (parentDrivePath, MainDlg, FALSE) == 2)
{
// The partition is within key scope of active system encryption
return FALSE;
}
return ((BOOL) BootEncObj->IsBootLoaderOnDrive (parentDrivePath));
}
catch (...)
{
return FALSE;
}
@@ -932,49 +934,50 @@ BOOL SelectItem (HWND hTree, char nLetter) }
return TRUE;
}
static void LaunchVolCreationWizard (HWND hwndDlg, const char *arg)
{
char t[TC_MAX_PATH] = {'"',0};
char *tmp;
GetModuleFileName (NULL, t+1, sizeof(t)-1);
tmp = strrchr (t, '\\');
if (tmp)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory (&si, sizeof (si));
- strcpy (++tmp, "VeraCrypt Format.exe\"");
+ *tmp = 0;
+ StringCbCopyA (t, sizeof(t), "\\VeraCrypt Format.exe\"");
if (!FileExists(t))
Error ("VOL_CREATION_WIZARD_NOT_FOUND"); // Display a user-friendly error message and advise what to do
if (strlen (arg) > 0)
{
- strcat (t, " ");
- strcat (t, arg);
+ StringCbCatA (t, sizeof(t), " ");
+ StringCbCatA (t, sizeof(t), arg);
}
if (!CreateProcess (NULL, (LPSTR) t, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi))
{
handleWin32Error (hwndDlg);
}
else
{
CloseHandle (pi.hProcess);
CloseHandle (pi.hThread);
}
}
}
// Fills drive list
// drive>0 = update only the corresponding drive subitems
void LoadDriveLetters (HWND hTree, int drive)
{
// Remember the top-most visible item
@@ -1051,91 +1054,92 @@ void LoadDriveLetters (HWND hTree, int drive) {
LVITEM tmp;
memset(&tmp, 0, sizeof(LVITEM));
tmp.mask = LVIF_PARAM;
tmp.iItem = item;
if (ListView_GetItem (hTree, &tmp))
curDrive = HIWORD(tmp.lParam);
}
{
char szTmp[1024];
wchar_t szTmpW[1024];
memset(&listItem, 0, sizeof(listItem));
listItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
listItem.iImage = 2;
listItem.iItem = item++;
listItem.pszText = szTmp;
- strcpy (szTmp, " ");
+ szTmp[0] = ' ';
+ szTmp[1] = 0;
listItem.lParam = MAKELONG (TC_MLIST_ITEM_SYS_DRIVE, ENC_SYSDRIVE_PSEUDO_DRIVE_LETTER);
if(drive == 0)
ListView_InsertItem (hTree, &listItem);
else
ListView_SetItem (hTree, &listItem);
listItem.mask=LVIF_TEXT;
// Fully encrypted
if (SysDriveOrPartitionFullyEncrypted (TRUE))
{
- wcscpy (szTmpW, GetString ("SYSTEM_DRIVE"));
+ StringCbCopyW (szTmpW, sizeof(szTmpW), GetString ("SYSTEM_DRIVE"));
}
else
{
// Partially encrypted
if (BootEncStatus.SetupInProgress)
{
// Currently encrypting/decrypting
if (BootEncStatus.SetupMode != SetupDecryption)
{
- _snwprintf (szTmpW,
- sizeof szTmpW/2,
+ StringCbPrintfW (szTmpW,
+ sizeof szTmpW,
GetString ("SYSTEM_DRIVE_ENCRYPTING"),
(double) GetSysEncDeviceEncryptedPartSize (TRUE) / (double) GetSysEncDeviceSize (TRUE) * 100.0);
}
else
{
- _snwprintf (szTmpW,
- sizeof szTmpW/2,
+ StringCbPrintfW (szTmpW,
+ sizeof szTmpW,
GetString ("SYSTEM_DRIVE_DECRYPTING"),
100.0 - ((double) GetSysEncDeviceEncryptedPartSize (TRUE) / (double) GetSysEncDeviceSize (TRUE) * 100.0));
}
}
else
{
- _snwprintf (szTmpW,
- sizeof szTmpW/2,
+ StringCbPrintfW (szTmpW,
+ sizeof szTmpW,
GetString ("SYSTEM_DRIVE_PARTIALLY_ENCRYPTED"),
(double) GetSysEncDeviceEncryptedPartSize (TRUE) / (double) GetSysEncDeviceSize (TRUE) * 100.0);
}
}
ListSubItemSetW (hTree, listItem.iItem, 1, szTmpW);
- GetSizeString (GetSysEncDeviceSize(TRUE), szTmpW);
+ GetSizeString (GetSysEncDeviceSize(TRUE), szTmpW, sizeof(szTmpW));
ListSubItemSetW (hTree, listItem.iItem, 2, szTmpW);
EAGetName (szTmp, propSysEnc.ea);
listItem.iSubItem = 3;
ListView_SetItem (hTree, &listItem);
ListSubItemSetW (hTree, listItem.iItem, 4, GetString (IsHiddenOSRunning() ? "HIDDEN" : "SYSTEM_VOLUME_TYPE_ADJECTIVE"));
}
}
/* Drive letters */
for (i = 2; i < 26; i++)
{
int curDrive = 0;
BOOL bSysEncPartition = (bSysEnc && !bWholeSysDriveEncryption && sysDriveLetter == *((char *) szDriveLetters[i]));
if (drive > 0)
{
@@ -1165,135 +1169,135 @@ void LoadDriveLetters (HWND hTree, int drive) listItem.lParam = MAKELONG (
bSysEncPartition ? TC_MLIST_ITEM_SYS_PARTITION : TC_MLIST_ITEM_NONSYS_VOL,
i + 'A');
listItem.pszText = szDriveLetters[i];
if (drive == 0)
ListView_InsertItem (hTree, &listItem);
else
ListView_SetItem (hTree, &listItem);
listItem.mask=LVIF_TEXT;
listItem.pszText = szTmp;
if (bSysEncPartition)
{
// Fully encrypted
if (SysDriveOrPartitionFullyEncrypted (TRUE))
{
- wcscpy (szTmpW, GetString (IsHiddenOSRunning() ? "HIDDEN_SYSTEM_PARTITION" : "SYSTEM_PARTITION"));
+ StringCbCopyW (szTmpW, sizeof(szTmpW), GetString (IsHiddenOSRunning() ? "HIDDEN_SYSTEM_PARTITION" : "SYSTEM_PARTITION"));
}
else
{
// Partially encrypted
if (BootEncStatus.SetupInProgress)
{
// Currently encrypting/decrypting
if (BootEncStatus.SetupMode != SetupDecryption)
{
- _snwprintf (szTmpW,
- sizeof szTmpW/2,
+ StringCbPrintfW (szTmpW,
+ sizeof szTmpW,
GetString ("SYSTEM_PARTITION_ENCRYPTING"),
(double) GetSysEncDeviceEncryptedPartSize (TRUE) / (double) GetSysEncDeviceSize (TRUE) * 100.0);
}
else
{
- _snwprintf (szTmpW,
- sizeof szTmpW/2,
+ StringCbPrintfW (szTmpW,
+ sizeof szTmpW,
GetString ("SYSTEM_PARTITION_DECRYPTING"),
100.0 - ((double) GetSysEncDeviceEncryptedPartSize (TRUE) / (double) GetSysEncDeviceSize (TRUE) * 100.0));
}
}
else
{
- _snwprintf (szTmpW,
- sizeof szTmpW/2,
+ StringCbPrintfW (szTmpW,
+ sizeof szTmpW,
GetString ("SYSTEM_PARTITION_PARTIALLY_ENCRYPTED"),
(double) GetSysEncDeviceEncryptedPartSize (TRUE) / (double) GetSysEncDeviceSize (TRUE) * 100.0);
}
}
ListSubItemSetW (hTree, listItem.iItem, 1, szTmpW);
}
else
{
- ToSBCS (driver.wszVolume[i]);
+ ToSBCS (driver.wszVolume[i], sizeof(driver.wszVolume[i]));
char *path = (char *) driver.wszVolume[i];
if (memcmp (path, "\\??\\", 4) == 0)
path += 4;
listItem.iSubItem = 1;
wstring label = GetFavoriteVolumeLabel (path);
if (!label.empty())
ListSubItemSetW (hTree, listItem.iItem, 1, (wchar_t *) label.c_str());
else
ListSubItemSet (hTree, listItem.iItem, 1, (char *) FitPathInGfxWidth (hTree, hUserFont, ListView_GetColumnWidth (hTree, 1) - GetTextGfxWidth (hTree, L"___", hUserFont), path).c_str());
}
- GetSizeString (bSysEncPartition ? GetSysEncDeviceSize(TRUE) : driver.diskLength[i], szTmpW);
+ GetSizeString (bSysEncPartition ? GetSysEncDeviceSize(TRUE) : driver.diskLength[i], szTmpW, sizeof(szTmpW));
ListSubItemSetW (hTree, listItem.iItem, 2, szTmpW);
EAGetName (szTmp, bSysEncPartition ? propSysEnc.ea : driver.ea[i]);
listItem.iSubItem = 3;
ListView_SetItem (hTree, &listItem);
if (bSysEncPartition)
{
ws = GetString (IsHiddenOSRunning() ? "HIDDEN" : "SYSTEM_VOLUME_TYPE_ADJECTIVE");
VolumeNotificationsList.bHidVolDamagePrevReported[i] = FALSE;
ListSubItemSetW (hTree, listItem.iItem, 4, ws);
}
else
{
switch (driver.volumeType[i])
{
case PROP_VOL_TYPE_NORMAL:
ws = GetString ("NORMAL");
break;
case PROP_VOL_TYPE_HIDDEN:
ws = GetString ("HIDDEN");
break;
case PROP_VOL_TYPE_OUTER:
ws = GetString ("OUTER"); // Normal/outer volume (hidden volume protected)
break;
case PROP_VOL_TYPE_OUTER_VOL_WRITE_PREVENTED:
ws = GetString ("OUTER_VOL_WRITE_PREVENTED"); // Normal/outer volume (hidden volume protected AND write denied)
break;
default:
ws = L"?";
}
ListSubItemSetW (hTree, listItem.iItem, 4, ws);
if (driver.volumeType[i] == PROP_VOL_TYPE_OUTER_VOL_WRITE_PREVENTED) // Normal/outer volume (hidden volume protected AND write denied)
{
if (!VolumeNotificationsList.bHidVolDamagePrevReported[i])
{
wchar_t szTmp[4096];
VolumeNotificationsList.bHidVolDamagePrevReported[i] = TRUE;
- swprintf (szTmp, GetString ("DAMAGE_TO_HIDDEN_VOLUME_PREVENTED"), i+'A');
+ StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("DAMAGE_TO_HIDDEN_VOLUME_PREVENTED"), i+'A');
SetForegroundWindow (GetParent(hTree));
MessageBoxW (GetParent(hTree), szTmp, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
}
}
else
{
VolumeNotificationsList.bHidVolDamagePrevReported[i] = FALSE;
}
}
}
else
{
VolumeNotificationsList.bHidVolDamagePrevReported[i] = FALSE;
if (!(dwUsedDrives & 1 << i))
{
if(drive > 0 && drive != HIWORD (GetSelectedLong (hTree)))
{
item++;
continue;
@@ -1537,59 +1541,59 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp);
SetWindowText (GetDlgItem (hwndDlg, IDC_VERIFY), tmp);
SetWindowText (GetDlgItem (hwndDlg, IDC_OLD_PASSWORD), "");
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), "");
SetWindowText (GetDlgItem (hwndDlg, IDC_VERIFY), "");
keybLayout = (DWORD) LoadKeyboardLayout ("00000409", KLF_ACTIVATE);
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD);
Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION");
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
bKeyboardLayoutChanged = TRUE;
wchar_t szTmp [4096];
- wcscpy (szTmp, GetString ("KEYB_LAYOUT_CHANGE_PREVENTED"));
- wcscat (szTmp, L"\n\n");
- wcscat (szTmp, GetString ("KEYB_LAYOUT_SYS_ENC_EXPLANATION"));
+ StringCbCopyW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_CHANGE_PREVENTED"));
+ StringCbCatW (szTmp, sizeof(szTmp), L"\n\n");
+ StringCbCatW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_SYS_ENC_EXPLANATION"));
MessageBoxW (MainDlg, szTmp, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
}
/* Watch the right Alt key (which is used to enter various characters on non-US keyboards) */
if (bKeyboardLayoutChanged && !bKeybLayoutAltKeyWarningShown)
{
if (GetAsyncKeyState (VK_RMENU) < 0)
{
bKeybLayoutAltKeyWarningShown = TRUE;
wchar_t szTmp [4096];
- wcscpy (szTmp, GetString ("ALT_KEY_CHARS_NOT_FOR_SYS_ENCRYPTION"));
- wcscat (szTmp, L"\n\n");
- wcscat (szTmp, GetString ("KEYB_LAYOUT_SYS_ENC_EXPLANATION"));
+ StringCbCopyW (szTmp, sizeof(szTmp), GetString ("ALT_KEY_CHARS_NOT_FOR_SYS_ENCRYPTION"));
+ StringCbCatW (szTmp, sizeof(szTmp), L"\n\n");
+ StringCbCatW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_SYS_ENC_EXPLANATION"));
MessageBoxW (MainDlg, szTmp, lpszTitle, MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST);
}
}
}
return 1;
}
return 0;
case WM_COMMAND:
if (lw == IDCANCEL)
{
// Attempt to wipe passwords stored in the input field buffers
char tmp[MAX_PASSWORD+1];
memset (tmp, 'X', MAX_PASSWORD);
tmp[MAX_PASSWORD] = 0;
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp);
SetWindowText (GetDlgItem (hwndDlg, IDC_OLD_PASSWORD), tmp);
SetWindowText (GetDlgItem (hwndDlg, IDC_VERIFY), tmp);
RestoreDefaultKeyFilesParam ();
@@ -1882,46 +1886,46 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa {
case WM_INITDIALOG:
{
szXPwd = (Password *) lParam;
LocalizeDialog (hwndDlg, "IDD_PASSWORD_DLG");
DragAcceptFiles (hwndDlg, TRUE);
if (PasswordDialogTitleStringId)
{
SetWindowTextW (hwndDlg, GetString (PasswordDialogTitleStringId));
}
else if (strlen (PasswordDlgVolume) > 0)
{
wchar_t s[1024];
RECT rect;
GetWindowRect (hwndDlg, &rect);
wstring label = GetFavoriteVolumeLabel (PasswordDlgVolume);
if (!label.empty())
{
- wsprintfW (s, GetString ("ENTER_PASSWORD_FOR_LABEL"), label.c_str());
+ StringCbPrintfW (s, sizeof(s), GetString ("ENTER_PASSWORD_FOR_LABEL"), label.c_str());
}
else
{
- wsprintfW (s, GetString ("ENTER_PASSWORD_FOR"), "___");
- wsprintfW (s, GetString ("ENTER_PASSWORD_FOR"), FitPathInGfxWidth (hwndDlg, WindowTitleBarFont, rect.right - rect.left - GetTextGfxWidth (hwndDlg, s, WindowTitleBarFont), PasswordDlgVolume).c_str());
+ StringCbPrintfW (s, sizeof(s), GetString ("ENTER_PASSWORD_FOR"), "___");
+ StringCbPrintfW (s, sizeof(s), GetString ("ENTER_PASSWORD_FOR"), FitPathInGfxWidth (hwndDlg, WindowTitleBarFont, rect.right - rect.left - GetTextGfxWidth (hwndDlg, s, WindowTitleBarFont), PasswordDlgVolume).c_str());
}
SetWindowTextW (hwndDlg, s);
}
SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_LIMITTEXT, MAX_PASSWORD, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_CACHE), BM_SETCHECK, bCacheInDriver ? BST_CHECKED:BST_UNCHECKED, 0);
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable);
mountOptions.PartitionInInactiveSysEncScope = bPrebootPasswordDlgMode;
if (bPrebootPasswordDlgMode)
{
SendMessage (hwndDlg, TC_APPMSG_PREBOOT_PASSWORD_MODE, 0, 0);
}
if (PasswordDialogDisableMountOptions)
{
EnableWindow (GetDlgItem (hwndDlg, IDC_CACHE), FALSE);
@@ -1940,41 +1944,41 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa flash.uCount = 0;
FlashWindowEx (&flash);
SetWindowPos (hwndDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
}
return 0;
case TC_APPMSG_PREBOOT_PASSWORD_MODE:
{
ToBootPwdField (hwndDlg, IDC_PASSWORD);
// Attempt to wipe the password stored in the input field buffer
char tmp[MAX_PASSWORD+1];
memset (tmp, 'X', MAX_PASSWORD);
tmp [MAX_PASSWORD] = 0;
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp);
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), "");
- sprintf (OrigKeyboardLayout, "%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF);
+ StringCbPrintfA (OrigKeyboardLayout, sizeof(OrigKeyboardLayout),"%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF);
DWORD keybLayout = (DWORD) LoadKeyboardLayout ("00000409", KLF_ACTIVATE);
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION");
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
if (SetTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD, TIMER_INTERVAL_KEYB_LAYOUT_GUARD, NULL) == 0)
{
Error ("CANNOT_SET_TIMER");
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
SetCheckBox (hwndDlg, IDC_SHOW_PASSWORD, FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_SHOW_PASSWORD), FALSE);
@@ -1998,43 +2002,43 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa // Keyboard layout is not standard US
// Attempt to wipe the password stored in the input field buffer
char tmp[MAX_PASSWORD+1];
memset (tmp, 'X', MAX_PASSWORD);
tmp [MAX_PASSWORD] = 0;
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp);
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), "");
keybLayout = (DWORD) LoadKeyboardLayout ("00000409", KLF_ACTIVATE);
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD);
Error ("CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION");
EndDialog (hwndDlg, IDCANCEL);
return 1;
}
wchar_t szTmp [4096];
- wcscpy (szTmp, GetString ("KEYB_LAYOUT_CHANGE_PREVENTED"));
- wcscat (szTmp, L"\n\n");
- wcscat (szTmp, GetString ("KEYB_LAYOUT_SYS_ENC_EXPLANATION"));
+ StringCbCopyW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_CHANGE_PREVENTED"));
+ StringCbCatW (szTmp, sizeof(szTmp), L"\n\n");
+ StringCbCatW (szTmp, sizeof(szTmp), GetString ("KEYB_LAYOUT_SYS_ENC_EXPLANATION"));
MessageBoxW (MainDlg, szTmp, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
}
}
return 1;
}
return 0;
case WM_COMMAND:
if (lw == IDC_MOUNT_OPTIONS)
{
DialogBoxParamW (hInst,
MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg,
(DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions);
if (!bPrebootPasswordDlgMode && mountOptions.PartitionInInactiveSysEncScope)
SendMessage (hwndDlg, TC_APPMSG_PREBOOT_PASSWORD_MODE, 0, 0);
return 1;
}
@@ -2135,43 +2139,46 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa popupPos.y = buttonRect.top + 2;
if (KeyfilesPopupMenu (hwndDlg, popupPos, ¶m))
{
KeyFilesEnable = param.EnableKeyFiles;
FirstKeyFile = param.FirstKeyFile;
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable);
}
}
}
break;
case WM_DROPFILES:
{
HDROP hdrop = (HDROP) wParam;
int i = 0, count = DragQueryFile (hdrop, 0xFFFFFFFF, NULL, 0);
while (count-- > 0)
{
KeyFile *kf = (KeyFile *) malloc (sizeof (KeyFile));
- DragQueryFile (hdrop, i++, kf->FileName, sizeof (kf->FileName));
- FirstKeyFile = KeyFileAdd (FirstKeyFile, kf);
- KeyFilesEnable = TRUE;
+ if (kf)
+ {
+ DragQueryFile (hdrop, i++, kf->FileName, sizeof (kf->FileName));
+ FirstKeyFile = KeyFileAdd (FirstKeyFile, kf);
+ KeyFilesEnable = TRUE;
+ }
}
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable);
DragFinish (hdrop);
}
return 1;
}
return 0;
}
static void PreferencesDlgEnableButtons (HWND hwndDlg)
{
BOOL back = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_BKG_TASK_ENABLE));
BOOL idle = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_DISMOUNT_INACTIVE));
BOOL installed = !IsNonInstallMode();
EnableWindow (GetDlgItem (hwndDlg, IDC_CLOSE_BKG_TASK_WHEN_NOVOL), back && installed);
EnableWindow (GetDlgItem (hwndDlg, IDT_LOGON), installed);
EnableWindow (GetDlgItem (hwndDlg, IDC_PREF_LOGON_START), back && installed);
@@ -2334,57 +2341,61 @@ BOOL CALLBACK PreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM bForceAutoDismount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_FORCE_AUTO_DISMOUNT));
MaxVolumeIdleTime = GetDlgItemInt (hwndDlg, IDC_PREF_DISMOUNT_INACTIVE_TIME, NULL, FALSE)
* (IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_DISMOUNT_INACTIVE)) ? 1 : -1);
bStartOnLogon = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_LOGON_START));
bMountDevicesOnLogon = IsButtonChecked (GetDlgItem (hwndDlg, IDC_PREF_LOGON_MOUNT_DEVICES));
ManageStartupSeq ();
SaveSettings (hwndDlg);
NormalCursor ();
PreferencesDialogActive = FALSE;
EndDialog (hwndDlg, lw);
return 1;
}
if (lw == IDC_MORE_SETTINGS)
{
HMENU popup = CreatePopupMenu ();
+ if (popup)
+ {
+ AppendMenuW (popup, MF_STRING, IDM_LANGUAGE, GetString ("IDM_LANGUAGE"));
+ AppendMenuW (popup, MF_STRING, IDM_HOTKEY_SETTINGS, GetString ("IDM_HOTKEY_SETTINGS"));
+ AppendMenuW (popup, MF_STRING, IDM_PERFORMANCE_SETTINGS, GetString ("IDM_PERFORMANCE_SETTINGS"));
+ AppendMenuW (popup, MF_STRING, IDM_SYSENC_SETTINGS, GetString ("IDM_SYSENC_SETTINGS"));
+ AppendMenuW (popup, MF_STRING, IDM_SYS_FAVORITES_SETTINGS, GetString ("IDM_SYS_FAVORITES_SETTINGS"));
+ AppendMenuW (popup, MF_STRING, IDM_DEFAULT_KEYFILES, GetString ("IDM_DEFAULT_KEYFILES"));
+ AppendMenuW (popup, MF_STRING, IDM_TOKEN_PREFERENCES, GetString ("IDM_TOKEN_PREFERENCES"));
- AppendMenuW (popup, MF_STRING, IDM_LANGUAGE, GetString ("IDM_LANGUAGE"));
- AppendMenuW (popup, MF_STRING, IDM_HOTKEY_SETTINGS, GetString ("IDM_HOTKEY_SETTINGS"));
- AppendMenuW (popup, MF_STRING, IDM_PERFORMANCE_SETTINGS, GetString ("IDM_PERFORMANCE_SETTINGS"));
- AppendMenuW (popup, MF_STRING, IDM_SYSENC_SETTINGS, GetString ("IDM_SYSENC_SETTINGS"));
- AppendMenuW (popup, MF_STRING, IDM_SYS_FAVORITES_SETTINGS, GetString ("IDM_SYS_FAVORITES_SETTINGS"));
- AppendMenuW (popup, MF_STRING, IDM_DEFAULT_KEYFILES, GetString ("IDM_DEFAULT_KEYFILES"));
- AppendMenuW (popup, MF_STRING, IDM_TOKEN_PREFERENCES, GetString ("IDM_TOKEN_PREFERENCES"));
-
- RECT rect;
- GetWindowRect (GetDlgItem (hwndDlg, IDC_MORE_SETTINGS), &rect);
+ RECT rect;
+ GetWindowRect (GetDlgItem (hwndDlg, IDC_MORE_SETTINGS), &rect);
- int menuItem = TrackPopupMenu (popup, TPM_RETURNCMD | TPM_LEFTBUTTON, rect.left + 2, rect.top + 2, 0, hwndDlg, NULL);
- DestroyMenu (popup);
+ int menuItem = TrackPopupMenu (popup, TPM_RETURNCMD | TPM_LEFTBUTTON, rect.left + 2, rect.top + 2, 0, hwndDlg, NULL);
+ DestroyMenu (popup);
- SendMessage (MainDlg, WM_COMMAND, menuItem, NULL);
- return 1;
+ SendMessage (MainDlg, WM_COMMAND, menuItem, NULL);
+ return 1;
+ }
+ else
+ return 0;
}
if (HIWORD (wParam) == BN_CLICKED)
{
PreferencesDlgEnableButtons (hwndDlg);
return 1;
}
return 0;
}
return 0;
}
BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static MountOptions *mountOptions;
WORD lw = LOWORD (wParam);
@@ -2722,41 +2733,41 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP {
e.Show (MainDlg);
return 0;
}
}
else
{
if (!DeviceIoControl (hDriver, TC_IOCTL_GET_VOLUME_PROPERTIES, &prop, sizeof (prop), &prop, sizeof (prop), &dwResult, NULL) || dwResult == 0)
return 0;
}
// Location
ListItemAddW (list, i, GetString ("LOCATION"));
if (bSysEnc)
ListSubItemSetW (list, i++, 1, GetString (bSysEncWholeDrive ? "SYSTEM_DRIVE" : IsHiddenOSRunning() ? "HIDDEN_SYSTEM_PARTITION" : "SYSTEM_PARTITION"));
else
ListSubItemSetW (list, i++, 1, (wchar_t *) (prop.wszVolume[1] != L'?' ? prop.wszVolume : prop.wszVolume + 4));
// Size
ListItemAddW (list, i, GetString ("SIZE"));
- swprintf (sw, L"%I64u %s", prop.diskLength, GetString ("BYTES"));
+ StringCbPrintfW (sw, sizeof(sw), L"%I64u %s", prop.diskLength, GetString ("BYTES"));
ListSubItemSetW (list, i++, 1, sw);
// Type
ListItemAddW (list, i, GetString ("TYPE"));
if (bSysEnc)
ListSubItemSetW (list, i++, 1, GetString (IsHiddenOSRunning() ? "TYPE_HIDDEN_SYSTEM_ADJECTIVE" : "SYSTEM_VOLUME_TYPE_ADJECTIVE"));
else
{
ListSubItemSetW (list, i++, 1,
prop.hiddenVolume ? GetString ("HIDDEN") :
(prop.hiddenVolProtection != HIDVOL_PROT_STATUS_NONE ? GetString ("OUTER") : GetString ("NORMAL")));
}
if (!bSysEnc)
{
// Write protection
ListItemAddW (list, i, GetString ("READ_ONLY"));
if (prop.readOnly || prop.hiddenVolProtection == HIDVOL_PROT_STATUS_ACTION_TAKEN)
s = GetString ("UISTR_YES");
@@ -2785,82 +2796,82 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP if (prop.ea == 0 || prop.ea > EAGetCount ())
{
ListSubItemSet (list, i, 1, "?");
return 1;
}
EAGetName (szTmp, prop.ea);
ListSubItemSet (list, i++, 1, szTmp);
// Key size(s)
{
char name[128];
int size = EAGetKeySize (prop.ea);
EAGetName (name, prop.ea);
if (strcmp (name, "Triple DES") == 0) /* Deprecated/legacy */
size -= 3; // Compensate for parity bytes
// Primary key
ListItemAddW (list, i, GetString ("KEY_SIZE"));
- wsprintfW (sw, L"%d %s", size * 8, GetString ("BITS"));
+ StringCbPrintfW (sw, sizeof(sw), L"%d %s", size * 8, GetString ("BITS"));
ListSubItemSetW (list, i++, 1, sw);
if (strcmp (EAGetModeName (prop.ea, prop.mode, TRUE), "XTS") == 0)
{
// Secondary key (XTS)
ListItemAddW (list, i, GetString ("SECONDARY_KEY_SIZE_XTS"));
ListSubItemSetW (list, i++, 1, sw);
}
else if (strcmp (EAGetModeName (prop.ea, prop.mode, TRUE), "LRW") == 0)
{
// Tweak key (LRW)
ListItemAddW (list, i, GetString ("SECONDARY_KEY_SIZE_LRW"));
- swprintf (sw, L"%d %s", CipherGetBlockSize (EAGetFirstCipher(prop.ea))*8, GetString ("BITS"));
+ StringCbPrintfW (sw, sizeof(sw), L"%d %s", CipherGetBlockSize (EAGetFirstCipher(prop.ea))*8, GetString ("BITS"));
ListSubItemSetW (list, i++, 1, sw);
}
}
// Block size
ListItemAddW (list, i, GetString ("BLOCK_SIZE"));
if (EAGetFirstMode (prop.ea) == INNER_CBC)
{
// Cascaded ciphers with non-equal block sizes (deprecated/legacy)
wchar_t tmpstr[64];
int i = EAGetLastCipher(prop.ea);
- swprintf (sw, L"%d", CipherGetBlockSize(i)*8);
+ StringCbPrintfW (sw, sizeof(sw), L"%d", CipherGetBlockSize(i)*8);
while (i = EAGetPreviousCipher(prop.ea, i))
{
- swprintf (tmpstr, L"/%d", CipherGetBlockSize(i)*8);
- wcscat (sw, tmpstr);
+ StringCbPrintfW (tmpstr, sizeof(tmpstr), L"/%d", CipherGetBlockSize(i)*8);
+ StringCbCatW (sw, sizeof(sw), tmpstr);
}
- wcscat (sw, L" ");
+ StringCbCatW (sw, sizeof(sw), L" ");
}
else
{
- swprintf (sw, L"%d ", CipherGetBlockSize (EAGetFirstCipher(prop.ea))*8);
+ StringCbPrintfW (sw, sizeof(sw), L"%d ", CipherGetBlockSize (EAGetFirstCipher(prop.ea))*8);
}
- wcscat (sw, GetString ("BITS"));
+ StringCbCatW (sw, sizeof(sw), GetString ("BITS"));
ListSubItemSetW (list, i++, 1, sw);
// Mode
ListItemAddW (list, i, GetString ("MODE_OF_OPERATION"));
ListSubItemSet (list, i++, 1, EAGetModeName (prop.ea, prop.mode, TRUE));
// PKCS 5 PRF
ListItemAddW (list, i, GetString ("PKCS5_PRF"));
ListSubItemSet (list, i++, 1, get_pkcs5_prf_name (prop.pkcs5));
#if 0
// PCKS 5 iterations
ListItemAddW (list, i, GetString ("PKCS5_ITERATIONS"));
sprintf (szTmp, "%d", prop.pkcs5Iterations);
ListSubItemSet (list, i++, 1, szTmp);
#endif
#if 0
{
// Legacy
@@ -2889,75 +2900,75 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP swprintf (date, L"%s ", sw);
GetTimeFormatW (LOCALE_USER_DEFAULT, 0, &st, 0, sw, sizeof (sw)/2);
wcscat (date, sw);
GetLocalTime (&st);
SystemTimeToFileTime (&st, &curFt);
curFt64.HighPart = curFt.dwHighDateTime;
curFt64.LowPart = curFt.dwLowDateTime;
ft64.HighPart = ft.dwHighDateTime;
ft64.LowPart = ft.dwLowDateTime;
swprintf (date + wcslen (date), GetString ("VOLUME_HEADER_DAYS")
, (curFt64.QuadPart - ft64.QuadPart)/(24LL*3600*10000000));
ListSubItemSetW (list, i++, 1, date);
}
#endif // 0
if (!bSysEnc || IsHiddenOSRunning())
{
// Volume format version
ListItemAddW (list, i, GetString ("VOLUME_FORMAT_VERSION"));
- sprintf (szTmp, "%d", prop.volFormatVersion);
+ StringCbPrintfA (szTmp, sizeof(szTmp), "%d", prop.volFormatVersion);
ListSubItemSet (list, i++, 1, szTmp);
// Backup header
ListItemAddW (list, i, GetString ("BACKUP_HEADER"));
ListSubItemSetW (list, i++, 1, GetString (prop.volFormatVersion > 1 ? "UISTR_YES" : "UISTR_NO"));
}
// Total data read
ListItemAddW (list, i, GetString ("TOTAL_DATA_READ"));
- GetSizeString (prop.totalBytesRead, sw);
+ GetSizeString (prop.totalBytesRead, sw, sizeof(sw));
ListSubItemSetW (list, i++, 1, sw);
// Total data written
ListItemAddW (list, i, GetString ("TOTAL_DATA_WRITTEN"));
- GetSizeString (prop.totalBytesWritten, sw);
+ GetSizeString (prop.totalBytesWritten, sw, sizeof(sw));
ListSubItemSetW (list, i++, 1, sw);
if (bSysEnc)
{
// TrueCrypt Boot Loader version
ListItemAddW (list, i, GetString ("VC_BOOT_LOADER_VERSION"));
ListSubItemSet (list, i++, 1, (char *) GetUserFriendlyVersionString (BootEncStatus.BootLoaderVersion).c_str());
// Encrypted portion
ListItemAddW (list, i, GetString ("ENCRYPTED_PORTION"));
if (GetSysEncDeviceEncryptedPartSize (FALSE) == GetSysEncDeviceSize (FALSE))
ListSubItemSetW (list, i++, 1, GetString ("ENCRYPTED_PORTION_FULLY_ENCRYPTED"));
else if (GetSysEncDeviceEncryptedPartSize (FALSE) <= 1)
ListSubItemSetW (list, i++, 1, GetString ("ENCRYPTED_PORTION_NOT_ENCRYPTED"));
else
{
- _snwprintf (sw,
- sizeof sw/2,
+ StringCbPrintfW (sw,
+ sizeof sw,
GetString ("PROCESSED_PORTION_X_PERCENT"),
(double) GetSysEncDeviceEncryptedPartSize (FALSE) / (double) GetSysEncDeviceSize (FALSE) * 100.0);
ListSubItemSetW (list, i++, 1, sw);
}
}
return 0;
}
case WM_COMMAND:
if (lw == IDOK)
{
EndDialog (hwndDlg, lw);
return 1;
}
return 0;
case WM_CLOSE:
EndDialog (hwndDlg, lw);
@@ -3061,150 +3072,152 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa return 1;
}
if (lw == IDCANCEL || lw == IDCLOSE)
{
EndDialog (hwndDlg, lw);
return 1;
}
if (lw == IDC_CREATE)
{
BOOL copyWizard, bExplore, bCacheInDriver, bAutoRun, bAutoMount, bMountReadOnly;
char dstDir[MAX_PATH];
char srcPath[MAX_PATH * 2];
char dstPath[MAX_PATH * 2];
char appDir[MAX_PATH];
char sysDir[MAX_PATH];
char volName[MAX_PATH];
int drive;
+ char* ptr;
GetDlgItemText (hwndDlg, IDC_DIRECTORY, dstDir, sizeof dstDir);
volName[0] = 0;
GetDlgItemText (hwndDlg, IDC_VOLUME_NAME, volName + 1, sizeof volName);
drive = SendDlgItemMessage (hwndDlg, IDC_DRIVELIST, CB_GETCURSEL, 0, 0);
drive = SendDlgItemMessage (hwndDlg, IDC_DRIVELIST, CB_GETITEMDATA, drive, 0);
copyWizard = IsButtonChecked (GetDlgItem (hwndDlg, IDC_COPY_WIZARD));
bExplore = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAVEL_OPEN_EXPLORER));
bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAV_CACHE_PASSWORDS));
bMountReadOnly = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_READONLY));
bAutoRun = !IsButtonChecked (GetDlgItem (hwndDlg, IDC_AUTORUN_DISABLE));
bAutoMount = IsButtonChecked (GetDlgItem (hwndDlg, IDC_AUTORUN_MOUNT));
if (dstDir[0] == 0)
{
SetFocus (GetDlgItem (hwndDlg, IDC_DIRECTORY));
MessageBoxW (hwndDlg, GetString ("NO_PATH_SELECTED"), lpszTitle, MB_ICONEXCLAMATION);
return 1;
}
if (bAutoMount && volName[1] == 0)
{
SetFocus (GetDlgItem (hwndDlg, IDC_VOLUME_NAME));
MessageBoxW (hwndDlg, GetString ("NO_FILE_SELECTED"), lpszTitle, MB_ICONEXCLAMATION);
return 1;
}
if (volName[1] != 0)
{
volName[0] = '"';
- strcat (volName, "\"");
+ StringCbCatA (volName, sizeof(volName), "\"");
}
GetModuleFileName (NULL, appDir, sizeof (appDir));
- strrchr (appDir, '\\')[0] = 0;
+ if (ptr = strrchr (appDir, '\\'))
+ ptr[0] = 0;
WaitCursor ();
GetSystemDirectory (sysDir, sizeof (sysDir));
- sprintf (dstPath, "%s\\VeraCrypt", dstDir);
+ StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt", dstDir);
CreateDirectory (dstPath, NULL);
// Main app
- sprintf (srcPath, "%s\\VeraCrypt.exe", appDir);
- sprintf (dstPath, "%s\\VeraCrypt\\VeraCrypt.exe", dstDir);
+ StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\VeraCrypt.exe", appDir);
+ StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt\\VeraCrypt.exe", dstDir);
if (!TCCopyFile (srcPath, dstPath))
{
handleWin32Error (hwndDlg);
goto stop;
}
// Wizard
if (copyWizard)
{
- sprintf (srcPath, "%s\\VeraCrypt Format.exe", appDir);
- sprintf (dstPath, "%s\\VeraCrypt\\VeraCrypt Format.exe", dstDir);
+ StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\VeraCrypt Format.exe", appDir);
+ StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt\\VeraCrypt Format.exe", dstDir);
if (!TCCopyFile (srcPath, dstPath))
{
handleWin32Error (hwndDlg);
goto stop;
}
}
// Driver
- sprintf (srcPath, "%s\\veracrypt.sys", appDir);
- sprintf (dstPath, "%s\\VeraCrypt\\veracrypt.sys", dstDir);
+ StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\veracrypt.sys", appDir);
+ StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt\\veracrypt.sys", dstDir);
if (!TCCopyFile (srcPath, dstPath))
{
handleWin32Error (hwndDlg);
goto stop;
}
// Driver x64
- sprintf (srcPath, "%s\\veracrypt-x64.sys", appDir);
- sprintf (dstPath, "%s\\VeraCrypt\\veracrypt-x64.sys", dstDir);
+ StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\veracrypt-x64.sys", appDir);
+ StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt\\veracrypt-x64.sys", dstDir);
if (!TCCopyFile (srcPath, dstPath))
{
handleWin32Error (hwndDlg);
goto stop;
}
if (GetPreferredLangId () && strcmp (GetPreferredLangId (), "en") != 0)
{
// Language pack
- sprintf (srcPath, "%s\\Language.%s.xml", appDir, GetPreferredLangId ());
- sprintf (dstPath, "%s\\VeraCrypt\\Language.%s.xml", dstDir, GetPreferredLangId ());
+ StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\Language.%s.xml", appDir, GetPreferredLangId ());
+ StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt\\Language.%s.xml", dstDir, GetPreferredLangId ());
TCCopyFile (srcPath, dstPath);
}
// AutoRun
- sprintf (dstPath, "%s\\autorun.inf", dstDir);
+ StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\autorun.inf", dstDir);
DeleteFile (dstPath);
if (bAutoRun)
{
FILE *af;
char autoMount[100];
char driveLetter[] = { ' ', '/', 'l', (char) drive, 0 };
af = fopen (dstPath, "w,ccs=UNICODE");
if (af == NULL)
{
MessageBoxW (hwndDlg, GetString ("CANT_CREATE_AUTORUN"), lpszTitle, MB_ICONERROR);
goto stop;
}
- sprintf (autoMount, "VeraCrypt\\VeraCrypt.exe /q background%s%s%s%s /m rm /v %s",
+ StringCbPrintfA (autoMount, sizeof(autoMount), "VeraCrypt\\VeraCrypt.exe /q background%s%s%s%s /m rm /v %s",
drive > 0 ? driveLetter : "",
bExplore ? " /e" : "",
bCacheInDriver ? " /c y" : "",
bMountReadOnly ? " /m ro" : "",
volName);
fwprintf (af, L"[autorun]\nlabel=%s\nicon=VeraCrypt\\VeraCrypt.exe\n", GetString ("TC_TRAVELER_DISK"));
fwprintf (af, L"action=%s\n", bAutoMount ? GetString ("MOUNT_TC_VOLUME") : GetString ("IDC_PREF_LOGON_START"));
fwprintf (af, L"open=%hs\n", bAutoMount ? autoMount : "VeraCrypt\\VeraCrypt.exe");
fwprintf (af, L"shell\\start=%s\nshell\\start\\command=VeraCrypt\\VeraCrypt.exe\n", GetString ("IDC_PREF_LOGON_START"));
fwprintf (af, L"shell\\dismount=%s\nshell\\dismount\\command=VeraCrypt\\VeraCrypt.exe /q /d\n", GetString ("DISMOUNT_ALL_TC_VOLUMES"));
CheckFileStreamWriteErrors (af, dstPath);
fclose (af);
}
MessageBoxW (hwndDlg, GetString ("TRAVELER_DISK_CREATED"), lpszTitle, MB_ICONINFORMATION);
stop:
NormalCursor ();
return 1;
@@ -3435,41 +3448,41 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName) if (modeOfOperation == CBC || modeOfOperation == OUTER_CBC)
Warning("WARN_CBC_MODE");
// Check for deprecated 64-bit-block ciphers
if (GetCipherBlockSizeByDriveNo (nDosDriveNo) == 64)
Warning("WARN_64_BIT_BLOCK_CIPHER");
// Check for problematic file extensions (exe, dll, sys)
if (CheckFileExtension(szFileName))
Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING");
}
while (mounted == 0)
{
if (CmdVolumePassword.Length > 0)
{
VolumePassword = CmdVolumePassword;
}
else if (!Silent)
{
- strcpy (PasswordDlgVolume, szFileName);
+ StringCbCopyA (PasswordDlgVolume, sizeof(PasswordDlgVolume), szFileName);
if (!AskVolumePassword (hwndDlg, &VolumePassword, NULL, TRUE))
goto ret;
}
WaitCursor ();
if (KeyFilesEnable)
KeyFilesApply (&VolumePassword, FirstKeyFile);
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, bCacheInDriver, bForceMount, &mountOptions, Silent, !Silent);
NormalCursor ();
// Check for deprecated CBC mode
modeOfOperation = GetModeOfOperationByDriveNo (nDosDriveNo);
if (modeOfOperation == CBC || modeOfOperation == OUTER_CBC)
Warning("WARN_CBC_MODE");
// Check for deprecated 64-bit-block ciphers
if (GetCipherBlockSizeByDriveNo (nDosDriveNo) == 64)
@@ -3598,41 +3611,41 @@ retry: do
{
bResult = DeviceIoControl (hDriver, TC_IOCTL_DISMOUNT_ALL_VOLUMES, &unmount,
sizeof (unmount), &unmount, sizeof (unmount), &dwResult, NULL);
if (bResult == FALSE)
{
NormalCursor();
handleWin32Error (hwndDlg);
return FALSE;
}
if (unmount.nReturnCode == ERR_SUCCESS
&& unmount.HiddenVolumeProtectionTriggered
&& !VolumeNotificationsList.bHidVolDamagePrevReported [unmount.nDosDriveNo])
{
wchar_t msg[4096];
VolumeNotificationsList.bHidVolDamagePrevReported [unmount.nDosDriveNo] = TRUE;
- swprintf (msg, GetString ("DAMAGE_TO_HIDDEN_VOLUME_PREVENTED"), unmount.nDosDriveNo + 'A');
+ StringCbPrintfW (msg, sizeof(msg), GetString ("DAMAGE_TO_HIDDEN_VOLUME_PREVENTED"), unmount.nDosDriveNo + 'A');
SetForegroundWindow (hwndDlg);
MessageBoxW (hwndDlg, msg, lpszTitle, MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
unmount.HiddenVolumeProtectionTriggered = FALSE;
continue;
}
if (unmount.nReturnCode == ERR_FILES_OPEN)
Sleep (dismountAutoRetryDelay);
else
break;
} while (--dismountMaxRetries > 0);
memset (&mountList, 0, sizeof (mountList));
DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, &mountList, sizeof (mountList), &mountList, sizeof (mountList), &dwResult, NULL);
BroadcastDeviceChange (DBT_DEVICEREMOVECOMPLETE, 0, prevMountedDrives & ~mountList.ulMountedDrives);
RefreshMainDlg (hwndDlg);
@@ -3819,43 +3832,43 @@ static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt) IncreaseWrongPwdRetryCount (1);
if (WrongPwdRetryCountOverLimit ()
&& !mountOptions.UseBackupHeader
&& !bHeaderBakRetry)
{
// Retry using embedded header backup (if any)
mountOptions.UseBackupHeader = TRUE;
bHeaderBakRetry = TRUE;
}
else if (bHeaderBakRetry)
{
mountOptions.UseBackupHeader = defaultMountOptions.UseBackupHeader;
bHeaderBakRetry = FALSE;
}
if (!Silent && !bHeaderBakRetry)
{
WCHAR szTmp[4096];
- swprintf (szTmp, GetString (KeyFilesEnable || FirstCmdKeyFile ? "PASSWORD_OR_KEYFILE_WRONG_AUTOMOUNT" : "PASSWORD_WRONG_AUTOMOUNT"));
+ StringCbPrintfW (szTmp, sizeof(szTmp), GetString (KeyFilesEnable || FirstCmdKeyFile ? "PASSWORD_OR_KEYFILE_WRONG_AUTOMOUNT" : "PASSWORD_WRONG_AUTOMOUNT"));
if (CheckCapsLock (hwndDlg, TRUE))
- wcscat (szTmp, GetString ("PASSWORD_WRONG_CAPSLOCK_ON"));
+ StringCbCatW (szTmp, sizeof(szTmp), GetString ("PASSWORD_WRONG_CAPSLOCK_ON"));
MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_ICONWARNING);
}
}
else if (bHeaderBakRetry)
{
// We have successfully mounted a volume using the header backup embedded in the volume (the header is damaged)
mountOptions.UseBackupHeader = defaultMountOptions.UseBackupHeader;
bHeaderBakRetry = FALSE;
if (!Silent)
Warning ("HEADER_DAMAGED_AUTO_USED_HEADER_BAK");
}
if (!bHeaderBakRetry)
{
burn (&VolumePassword, sizeof (VolumePassword));
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
}
@@ -3969,41 +3982,41 @@ static void ChangeSysEncPassword (HWND hwndDlg, BOOL bOnlyChangeKDF) }
if (!BootEncStatus.DriveEncrypted
&& !BootEncStatus.DriveMounted
&& !BootEncStatus.VolumeHeaderPresent
&& !SysEncryptionOrDecryptionRequired ())
{
Warning ("SYS_DRIVE_NOT_ENCRYPTED");
return;
}
if (SysEncryptionOrDecryptionRequired ()
|| BootEncStatus.SetupInProgress)
{
Warning ("SYSTEM_ENCRYPTION_NOT_COMPLETED");
return;
}
if (CreateSysEncMutex ()) // If no instance of the wizard is currently taking care of system encryption
{
- sprintf (OrigKeyboardLayout, "%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF);
+ StringCbPrintfA (OrigKeyboardLayout, sizeof(OrigKeyboardLayout), "%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF);
bSysEncPwdChangeDlgMode = TRUE;
if (bOnlyChangeKDF)
pwdChangeDlgMode = PCDM_CHANGE_PKCS5_PRF;
else
pwdChangeDlgMode = PCDM_CHANGE_PASSWORD;
INT_PTR result = DialogBoxW (hInst, MAKEINTRESOURCEW (IDD_PASSWORDCHANGE_DLG), hwndDlg, (DLGPROC) PasswordChangeDlgProc);
bSysEncPwdChangeDlgMode = FALSE;
if (bKeyboardLayoutChanged)
{
// Restore the original keyboard layout
if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL)
Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT");
else
bKeyboardLayoutChanged = FALSE;
@@ -4234,41 +4247,41 @@ void CreateRescueDisk (void) char szRescueDiskISO [TC_MAX_PATH+1];
if (AskOkCancel ("RESCUE_DISK_NON_WIZARD_CREATION_SELECT_PATH") != IDOK)
{
CloseSysEncMutex ();
return;
}
char initialDir[MAX_PATH];
SHGetFolderPath (NULL, CSIDL_MYDOCUMENTS, NULL, 0, initialDir);
if (!BrowseFilesInDir (MainDlg, "OPEN_TITLE", initialDir, szRescueDiskISO, FALSE, TRUE, NULL, L"VeraCrypt Rescue Disk.iso", L"iso"))
{
CloseSysEncMutex ();
return;
}
WaitCursor();
BootEncObj->CreateRescueIsoImage (false, szRescueDiskISO);
- _snwprintf (szTmp, sizeof szTmp / 2,
+ StringCbPrintfW (szTmp, sizeof szTmp,
GetString (IsWindowsIsoBurnerAvailable() ? "RESCUE_DISK_NON_WIZARD_CREATION_WIN_ISOBURN" : "RESCUE_DISK_NON_WIZARD_CREATION_BURN"),
szRescueDiskISO);
if (IsWindowsIsoBurnerAvailable())
{
if (AskYesNoString (szTmp) == IDYES)
LaunchWindowsIsoBurner (MainDlg, szRescueDiskISO);
}
else
InfoDirect (szTmp);
}
catch (Exception &e)
{
e.Show (MainDlg);
Error ("ERROR_CREATING_RESCUE_DISK");
}
CloseSysEncMutex ();
NormalCursor ();
}
@@ -4768,41 +4781,41 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa KeyFilesApply (&CmdVolumePassword, FirstCmdKeyFile);
mounted = MountVolume (hwndDlg, szDriveLetter[0] - 'A',
szFileName, &CmdVolumePassword, bCacheInDriver, bForceMount,
&mountOptions, Silent, reportBadPasswd);
burn (&CmdVolumePassword, sizeof (CmdVolumePassword));
}
if (FirstCmdKeyFile)
{
FirstKeyFile = FirstCmdKeyFile;
KeyFilesEnable = TRUE;
}
// Ask user for password
while (!mounted && !Silent)
{
VolumePassword.Length = 0;
- strcpy (PasswordDlgVolume, szFileName);
+ StringCbCopyA (PasswordDlgVolume, sizeof(PasswordDlgVolume),szFileName);
if (!AskVolumePassword (hwndDlg, &VolumePassword, NULL, TRUE))
break;
WaitCursor ();
if (KeyFilesEnable && FirstKeyFile)
KeyFilesApply (&VolumePassword, FirstKeyFile);
mounted = MountVolume (hwndDlg, szDriveLetter[0] - 'A', szFileName, &VolumePassword, bCacheInDriver, bForceMount, &mountOptions, FALSE, TRUE);
burn (&VolumePassword, sizeof (VolumePassword));
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
NormalCursor ();
}
if (UsePreferences)
{
RestoreDefaultKeyFilesParam ();
bCacheInDriver = bCacheInDriverDefault;
@@ -5306,111 +5319,111 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa case TC_APPMSG_TASKBAR_ICON:
{
switch (lParam)
{
case WM_LBUTTONDOWN:
SetForegroundWindow (hwndDlg);
MainWindowHidden = FALSE;
ShowWindow (hwndDlg, SW_SHOW);
ShowWindow (hwndDlg, SW_RESTORE);
return 1;
case WM_RBUTTONUP:
{
POINT pos;
HMENU popup = CreatePopupMenu ();
int sel, i, n;
if (MainWindowHidden)
{
AppendMenuW (popup, MF_STRING, IDM_SHOW_HIDE, GetString ("SHOW_TC"));
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
}
else if (bEnableBkgTask
&& (!(LastKnownMountList.ulMountedDrives == 0
&& (bCloseBkgTaskWhenNoVolumes || IsNonInstallMode ())
&& !SysEncDeviceActive (TRUE)
&& GetDriverRefCount () < 2)))
{
AppendMenuW (popup, MF_STRING, IDM_SHOW_HIDE, GetString ("HIDE_TC"));
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
}
AppendMenuW (popup, MF_STRING, IDM_MOUNTALL, GetString ("IDC_MOUNTALL"));
AppendMenuW (popup, MF_STRING, IDM_MOUNT_FAVORITE_VOLUMES, GetString ("IDM_MOUNT_FAVORITE_VOLUMES"));
AppendMenuW (popup, MF_STRING, IDM_UNMOUNTALL, GetString ("IDC_UNMOUNTALL"));
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
for (n = 0; n < 2; n++)
{
for (i = 0; i < 26; i++)
{
if (LastKnownMountList.ulMountedDrives & (1 << i))
{
wchar_t s[1024];
wchar_t *vol = (wchar_t *) LastKnownMountList.wszVolume[i];
if (wcsstr (vol, L"\\??\\")) vol += 4;
wstring label = GetFavoriteVolumeLabel (WideToSingleString (vol));
- wsprintfW (s, L"%s %c: (%s)",
+ StringCbPrintfW (s, sizeof(s), L"%s %c: (%s)",
GetString (n==0 ? "OPEN" : "DISMOUNT"),
i + L'A',
label.empty() ? vol : label.c_str());
AppendMenuW (popup, MF_STRING, n*26 + TRAYICON_MENU_DRIVE_OFFSET + i, s);
}
}
if (LastKnownMountList.ulMountedDrives != 0)
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
}
AppendMenuW (popup, MF_STRING, IDM_HELP, GetString ("MENU_HELP"));
AppendMenuW (popup, MF_STRING, IDM_HOMEPAGE_SYSTRAY, GetString ("HOMEPAGE"));
AppendMenuW (popup, MF_STRING, IDM_PREFERENCES, GetString ("IDM_PREFERENCES"));
AppendMenuW (popup, MF_STRING, IDM_ABOUT, GetString ("IDM_ABOUT"));
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
AppendMenuW (popup, MF_STRING, IDCANCEL, GetString ("EXIT"));
GetCursorPos (&pos);
SetForegroundWindow(hwndDlg);
sel = TrackPopupMenu (popup,
TPM_RETURNCMD | TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON,
pos.x,
pos.y,
0,
hwndDlg,
NULL);
if (sel >= TRAYICON_MENU_DRIVE_OFFSET && sel < TRAYICON_MENU_DRIVE_OFFSET + 26)
{
OpenVolumeExplorerWindow (sel - TRAYICON_MENU_DRIVE_OFFSET);
}
else if (sel >= TRAYICON_MENU_DRIVE_OFFSET + 26 && sel < TRAYICON_MENU_DRIVE_OFFSET + 26*2)
{
if (CheckMountList ())
{
if (Dismount (hwndDlg, sel - TRAYICON_MENU_DRIVE_OFFSET - 26))
{
wchar_t txt [2048];
- wsprintfW (txt, GetString ("VOLUME_MOUNTED_AS_DRIVE_LETTER_X_DISMOUNTED"), sel - TRAYICON_MENU_DRIVE_OFFSET - 26 + L'A');
+ StringCbPrintfW (txt, sizeof(txt), GetString ("VOLUME_MOUNTED_AS_DRIVE_LETTER_X_DISMOUNTED"), sel - TRAYICON_MENU_DRIVE_OFFSET - 26 + L'A');
InfoBalloonDirect (GetString ("SUCCESSFULLY_DISMOUNTED"), txt);
}
}
}
else if (sel == IDM_SHOW_HIDE)
{
ChangeMainWindowVisibility ();
}
else if (sel == IDM_HOMEPAGE_SYSTRAY)
{
Applink ("home", TRUE, "");
}
else if (sel == IDCANCEL)
{
if ((LastKnownMountList.ulMountedDrives == 0
&& !SysEncDeviceActive (TRUE))
|| AskWarnNoYes ("CONFIRM_EXIT") == IDYES)
{
// Close all other TC windows
@@ -5482,41 +5495,41 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa UnmountVolume (hwndDlg, m, TRUE);
WarningBalloon ("HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE", "HOST_DEVICE_REMOVAL_DISMOUNT_WARN");
}
}
}
}
}
}
// Device-hosted volumes
for (m = 0; m < 26; m++)
{
if (LastKnownMountList.ulMountedDrives & (1 << m))
{
wchar_t *vol = (wchar_t *) LastKnownMountList.wszVolume[m];
char volp[MAX_PATH];
if (wcsstr (vol, L"\\??\\") == vol)
vol += 4;
- _snprintf (volp, sizeof(volp), "%ls", vol);
+ StringCbPrintfA (volp, sizeof(volp), "%ls", vol);
if (IsVolumeDeviceHosted (volp))
{
OPEN_TEST_STRUCT ots;
if (!OpenDevice (volp, &ots, FALSE))
{
UnmountVolume (hwndDlg, m, TRUE);
WarningBalloon ("HOST_DEVICE_REMOVAL_DISMOUNT_WARN_TITLE", "HOST_DEVICE_REMOVAL_DISMOUNT_WARN");
}
}
}
}
// Favorite volumes
UpdateDeviceHostedFavoriteVolumes();
return 1;
}
return 0;
@@ -5586,58 +5599,58 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa case LVN_BEGINRDRAG:
/* If the mouse was moving while the right mouse button is pressed, popup menu would
not open, because drag&drop operation would be initiated. Therefore, we're handling
RMB drag-and-drop operations as well. */
{
/* Drive list context menu */
int menuItem;
HMENU popup = CreatePopupMenu ();
SetFocus (GetDlgItem (hwndDlg, IDC_DRIVELIST));
switch (LOWORD (GetSelectedLong (GetDlgItem (hwndDlg, IDC_DRIVELIST))))
{
case TC_MLIST_ITEM_FREE:
// No mounted volume at this drive letter
AppendMenuW (popup, MF_STRING, IDM_MOUNT_VOLUME, GetString ("IDM_MOUNT_VOLUME"));
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
AppendMenuW (popup, MF_STRING, IDPM_SELECT_FILE_AND_MOUNT, GetString ("SELECT_FILE_AND_MOUNT"));
AppendMenuW (popup, MF_STRING, IDPM_SELECT_DEVICE_AND_MOUNT, GetString ("SELECT_DEVICE_AND_MOUNT"));
break;
case TC_MLIST_ITEM_NONSYS_VOL:
// There's a mounted non-system volume at this drive letter
AppendMenuW (popup, MF_STRING, IDM_UNMOUNT_VOLUME, GetString ("DISMOUNT"));
AppendMenuW (popup, MF_STRING, IDPM_OPEN_VOLUME, GetString ("OPEN"));
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
AppendMenuW (popup, MF_STRING, IDPM_CHECK_FILESYS, GetString ("IDPM_CHECK_FILESYS"));
AppendMenuW (popup, MF_STRING, IDPM_REPAIR_FILESYS, GetString ("IDPM_REPAIR_FILESYS"));
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
AppendMenuW (popup, MF_STRING, IDPM_ADD_TO_FAVORITES, GetString ("IDPM_ADD_TO_FAVORITES"));
AppendMenuW (popup, MF_STRING, IDPM_ADD_TO_SYSTEM_FAVORITES, GetString ("IDPM_ADD_TO_SYSTEM_FAVORITES"));
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
AppendMenuW (popup, MF_STRING, IDM_VOLUME_PROPERTIES, GetString ("IDPM_PROPERTIES"));
break;
case TC_MLIST_ITEM_SYS_PARTITION:
case TC_MLIST_ITEM_SYS_DRIVE:
// System partition/drive
PopulateSysEncContextMenu (popup, FALSE);
break;
}
mPos=GetMessagePos();
menuItem = TrackPopupMenu (popup,
TPM_RETURNCMD | TPM_LEFTBUTTON,
GET_X_LPARAM(mPos),
GET_Y_LPARAM(mPos),
0,
hwndDlg,
@@ -5850,44 +5863,44 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa break;
}
if (lw == IDC_VOLUME_TOOLS)
{
/* Volume Tools popup menu */
int menuItem;
char volPath[TC_MAX_PATH]; /* Volume to mount */
HMENU popup = CreatePopupMenu ();
RECT rect;
if (ActiveSysEncDeviceSelected ())
{
PopulateSysEncContextMenu (popup, TRUE);
}
else
{
AppendMenuW (popup, MF_STRING, IDM_CHANGE_PASSWORD, GetString ("IDM_CHANGE_PASSWORD"));
AppendMenuW (popup, MF_STRING, IDM_CHANGE_HEADER_KEY_DERIV_ALGO, GetString ("IDM_CHANGE_HEADER_KEY_DERIV_ALGO"));
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
AppendMenuW (popup, MF_STRING, IDM_ADD_REMOVE_VOL_KEYFILES, GetString ("IDM_ADD_REMOVE_VOL_KEYFILES"));
AppendMenuW (popup, MF_STRING, IDM_REMOVE_ALL_KEYFILES_FROM_VOL, GetString ("IDM_REMOVE_ALL_KEYFILES_FROM_VOL"));
- AppendMenu (popup, MF_SEPARATOR, 0, NULL);
+ AppendMenu (popup, MF_SEPARATOR, 0, "");
AppendMenuW (popup, MF_STRING, IDM_BACKUP_VOL_HEADER, GetString ("IDM_BACKUP_VOL_HEADER"));
AppendMenuW (popup, MF_STRING, IDM_RESTORE_VOL_HEADER, GetString ("IDM_RESTORE_VOL_HEADER"));
}
GetWindowRect (GetDlgItem (hwndDlg, IDC_VOLUME_TOOLS), &rect);
menuItem = TrackPopupMenu (popup,
TPM_RETURNCMD | TPM_LEFTBUTTON,
rect.left + 2,
rect.top + 2,
0,
hwndDlg,
NULL);
DestroyMenu (popup);
switch (menuItem)
{
case IDM_CHANGE_PASSWORD:
if (!VolumeSelected(hwndDlg))
@@ -6233,43 +6246,43 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa else
{
/* We need to resolve selection ambiguity. Two different mounted volumes are currently
selected (one in the drive letter list and the other in the input field below the list). */
VOLUME_PROPERTIES_STRUCT prop;
DWORD dwResult;
memset (&prop, 0, sizeof(prop));
prop.driveNo = HIWORD (selectedDrive) - 'A';
if (!DeviceIoControl (hDriver, TC_IOCTL_GET_VOLUME_PROPERTIES, &prop, sizeof (prop), &prop, sizeof (prop), &dwResult, NULL) || dwResult == 0)
{
Warning ("SELECT_A_MOUNTED_VOLUME");
return 1;
}
// volPathHigher will contain the volume path selected in the main drive list
wstring volPathHigher (prop.wszVolume);
- ToSBCS (prop.wszVolume);
- strcpy ((char *) volPathLowerW, volPathLower);
- ToUNICODE ((char *) volPathLowerW);
+ ToSBCS (prop.wszVolume, sizeof(prop.wszVolume));
+ StringCbCopyA ((char *) volPathLowerW, sizeof(volPathLowerW), volPathLower);
+ ToUNICODE ((char *) volPathLowerW, sizeof(volPathLowerW));
if (strcmp (((memcmp ((char *) prop.wszVolume, "\\??\\", 4) == 0) ? (char *) prop.wszVolume + 4 : (char *) prop.wszVolume), volPathLower) != 0)
{
// The path selected in the input field is different from the path to the volume selected
// in the drive lettter list. We have to resolve possible ambiguity.
wchar_t *tmp[] = {L"", L"", L"", L"", L"", 0};
const int maxVolPathLen = 80;
if (volPathHigher.length () > maxVolPathLen)
{
volPathHigher = wstring (L"...") + volPathHigher.substr (volPathHigher.length () - maxVolPathLen, maxVolPathLen);
}
wstring volPathLowerWStr (volPathLowerW);
if (volPathLowerWStr.length () > maxVolPathLen)
{
volPathLowerWStr = wstring (L"...") + volPathLowerWStr.substr (volPathLowerWStr.length () - maxVolPathLen, maxVolPathLen);
}
@@ -6683,42 +6696,45 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine) cmdUnmountDrive = -1;
break;
case OptionExplore:
bExplore = TRUE;
break;
case OptionForce:
bForceMount = TRUE;
bForceUnmount = TRUE;
break;
case OptionKeyfile:
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, nArgPos, &i,
nNoCommandLineArgs, tmpPath, sizeof (tmpPath)))
{
KeyFile *kf;
RelativePath2Absolute (tmpPath);
kf = (KeyFile *) malloc (sizeof (KeyFile));
- strncpy (kf->FileName, tmpPath, sizeof (kf->FileName) - 1);
- FirstCmdKeyFile = KeyFileAdd (FirstCmdKeyFile, kf);
+ if (kf)
+ {
+ StringCbCopyA (kf->FileName, sizeof(kf->FileName), tmpPath);
+ FirstCmdKeyFile = KeyFileAdd (FirstCmdKeyFile, kf);
+ }
}
break;
case OptionLetter:
GetArgumentValue (lpszCommandLineArgs, nArgPos, &i, nNoCommandLineArgs,
szDriveLetter, sizeof (szDriveLetter));
commandLineDrive = *szDriveLetter = (char) toupper (*szDriveLetter);
if (commandLineDrive < 'C' || commandLineDrive > 'Z')
AbortProcess ("BAD_DRIVE_LETTER");
break;
case OptionHistory:
{
char szTmp[8];
bHistory = bHistoryCmdLine = TRUE;
GetArgumentValue (lpszCommandLineArgs, nArgPos, &i, nNoCommandLineArgs,
szTmp, sizeof (szTmp));
@@ -7008,41 +7024,41 @@ BOOL TaskBarIconAdd (HWND hwnd) {
CloseHandle(TaskBarIconMutex);
TaskBarIconMutex = NULL;
}
return FALSE;
}
tnid.cbSize = sizeof (NOTIFYICONDATAW);
tnid.hWnd = hwnd;
tnid.uID = IDI_TRUECRYPT_ICON;
tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
tnid.uCallbackMessage = TC_APPMSG_TASKBAR_ICON;
tnid.hIcon = (HICON) LoadImage (hInst, MAKEINTRESOURCE (IDI_TRUECRYPT_ICON),
IMAGE_ICON,
ScreenDPI >= 120 ? 0 : 16,
ScreenDPI >= 120 ? 0 : 16,
(ScreenDPI >= 120 ? LR_DEFAULTSIZE : 0)
| LR_SHARED
| (nCurrentOS != WIN_2000 ? LR_DEFAULTCOLOR : LR_VGACOLOR)); // Windows 2000 cannot display more than 16 fixed colors in notification tray
- wcscpy (tnid.szTip, L"VeraCrypt");
+ StringCbCopyW (tnid.szTip, sizeof(tnid.szTip), L"VeraCrypt");
return Shell_NotifyIconW (NIM_ADD, &tnid);
}
BOOL TaskBarIconRemove (HWND hwnd)
{
if (TaskBarIconMutex != NULL)
{
NOTIFYICONDATA tnid;
BOOL res;
ZeroMemory (&tnid, sizeof (tnid));
tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = hwnd;
tnid.uID = IDI_TRUECRYPT_ICON;
res = Shell_NotifyIcon (NIM_DELETE, &tnid);
if (TaskBarIconMutex)
{
@@ -7433,51 +7449,58 @@ static void HandleHotKey (HWND hwndDlg, WPARAM wParam) break;
}
}
void ChangeMainWindowVisibility ()
{
MainWindowHidden = !MainWindowHidden;
if (!MainWindowHidden)
SetForegroundWindow (MainDlg);
ShowWindow (MainDlg, !MainWindowHidden ? SW_SHOW : SW_HIDE);
if (!MainWindowHidden)
ShowWindow (MainDlg, SW_RESTORE);
}
-int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, char *lpszVolume)
+int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const char *lpszVolume)
{
int nStatus = ERR_OS_ERROR;
wchar_t szTmp[4096];
int fBackup = -1;
OpenVolumeContext volume;
OpenVolumeContext hiddenVolume;
Password hiddenVolPassword;
byte temporaryKey[MASTER_KEYDATA_SIZE];
byte originalK2[MASTER_KEYDATA_SIZE];
+ if (!lpszVolume)
+ {
+ nStatus = ERR_OUTOFMEMORY;
+ handleError (hwndDlg, nStatus);
+ return nStatus;
+ }
+
volume.VolumeIsOpen = FALSE;
hiddenVolume.VolumeIsOpen = FALSE;
switch (IsSystemDevicePath (lpszVolume, hwndDlg, TRUE))
{
case 1:
case 2:
if (AskErrNoYes ("BACKUP_HEADER_NOT_FOR_SYS_DEVICE") == IDYES)
CreateRescueDisk ();
return 0;
}
if (IsMountedVolume (lpszVolume))
{
Warning ("DISMOUNT_FIRST");
goto ret;
}
if (!VolumePathExists (lpszVolume))
@@ -7543,41 +7566,41 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, char *lpszVolum }
}
break;
}
if (nStatus != ERR_PASSWORD_WRONG)
goto error;
handleError (hwndDlg, nStatus);
}
}
noHidden:
if (hiddenVolume.VolumeIsOpen && volume.CryptoInfo->LegacyVolume != hiddenVolume.CryptoInfo->LegacyVolume)
{
nStatus = ERR_PARAMETER_INCORRECT;
goto error;
}
- swprintf (szTmp, GetString ("CONFIRM_VOL_HEADER_BAK"), lpszVolume);
+ StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("CONFIRM_VOL_HEADER_BAK"), lpszVolume);
if (bRequireConfirmation
&& (MessageBoxW (hwndDlg, szTmp, lpszTitle, YES_NO|MB_ICONQUESTION|MB_DEFBUTTON1) == IDNO))
goto ret;
/* Select backup file */
if (!BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, TRUE, NULL))
goto ret;
/* Conceive the backup file */
if ((fBackup = _open(szFileName, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_BINARY, _S_IREAD|_S_IWRITE)) == -1)
{
nStatus = ERR_OS_ERROR;
goto error;
}
// Backup headers
byte backup[TC_VOLUME_HEADER_GROUP_SIZE];
@@ -7655,59 +7678,66 @@ error: if (fBackup != -1)
_close (fBackup);
SetLastError (dwError);
if (nStatus != 0)
handleError (hwndDlg, nStatus);
burn (&VolumePassword, sizeof (VolumePassword));
burn (&hiddenVolPassword, sizeof (hiddenVolPassword));
burn (temporaryKey, sizeof (temporaryKey));
burn (originalK2, sizeof (originalK2));
RestoreDefaultKeyFilesParam();
RandStop (FALSE);
NormalCursor();
return nStatus;
}
-int RestoreVolumeHeader (HWND hwndDlg, char *lpszVolume)
+int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
{
int nDosLinkCreated = -1, nStatus = ERR_OS_ERROR;
char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
char szFileName[TC_MAX_PATH];
char szDosDevice[TC_MAX_PATH];
void *dev = INVALID_HANDLE_VALUE;
DWORD dwError;
BOOL bDevice;
unsigned __int64 hostSize = 0;
FILETIME ftCreationTime;
FILETIME ftLastWriteTime;
FILETIME ftLastAccessTime;
wchar_t szTmp[4096];
BOOL bTimeStampValid = FALSE;
HANDLE fBackup = INVALID_HANDLE_VALUE;
LARGE_INTEGER headerOffset;
CRYPTO_INFO *restoredCryptoInfo = NULL;
+ if (!lpszVolume)
+ {
+ nStatus = ERR_OUTOFMEMORY;
+ handleError (hwndDlg, nStatus);
+ return nStatus;
+ }
+
switch (IsSystemDevicePath (lpszVolume, hwndDlg, TRUE))
{
case 1:
case 2:
if (AskErrNoYes ("RESTORE_HEADER_NOT_FOR_SYS_DEVICE") == IDYES)
CreateRescueDisk ();
return 0;
case -1:
// In some environments (such as PE), the system volume is not located on a hard drive.
// Therefore, we must interpret this return code as "Not a system device path" (otherwise,
// it would not be possible to restore headers on non-system devices in such environments).
// Note that this is rather safe, because bReliableRequired is set to TRUE.
// NOP
break;
}
if (IsMountedVolume (lpszVolume))
@@ -7733,41 +7763,41 @@ int RestoreVolumeHeader (HWND hwndDlg, char *lpszVolume) break;
case 2:
restoreInternalBackup = FALSE;
break;
default:
return 0;
}
OpenVolumeContext volume;
volume.VolumeIsOpen = FALSE;
WaitCursor();
if (restoreInternalBackup)
{
// Restore header from the internal backup
// Open the volume using backup header
while (TRUE)
{
- strncpy (PasswordDlgVolume, lpszVolume, sizeof (PasswordDlgVolume) - 1);
+ StringCbCopyA (PasswordDlgVolume, sizeof(PasswordDlgVolume), lpszVolume);
if (!AskVolumePassword (hwndDlg, &VolumePassword, NULL, FALSE))
{
nStatus = ERR_SUCCESS;
goto ret;
}
WaitCursor();
if (KeyFilesEnable && FirstKeyFile)
KeyFilesApply (&VolumePassword, FirstKeyFile);
nStatus = OpenVolume (&volume, lpszVolume, &VolumePassword, TRUE, bPreserveTimestamp, TRUE);
NormalCursor();
if (nStatus == ERR_SUCCESS)
break;
if (nStatus != ERR_PASSWORD_WRONG)
goto error;
@@ -7789,78 +7819,78 @@ int RestoreVolumeHeader (HWND hwndDlg, char *lpszVolume) if (nStatus != 0)
goto error;
headerOffset.QuadPart = volume.CryptoInfo->hiddenVolume ? TC_HIDDEN_VOLUME_HEADER_OFFSET : TC_VOLUME_HEADER_OFFSET;
if (!SetFilePointerEx (volume.HostFileHandle, headerOffset, NULL, FILE_BEGIN))
{
nStatus = ERR_OS_ERROR;
goto error;
}
if (!WriteEffectiveVolumeHeader (volume.IsDevice, volume.HostFileHandle, (byte *) buffer))
{
nStatus = ERR_OS_ERROR;
goto error;
}
}
else
{
// Restore header from an external backup
- swprintf (szTmp, GetString ("CONFIRM_VOL_HEADER_RESTORE"), lpszVolume);
+ StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("CONFIRM_VOL_HEADER_RESTORE"), lpszVolume);
if (MessageBoxW (hwndDlg, szTmp, lpszTitle, YES_NO|MB_ICONWARNING|MB_DEFBUTTON2) == IDNO)
{
nStatus = ERR_SUCCESS;
goto ret;
}
/* Select backup file */
if (!BrowseFiles (hwndDlg, "OPEN_TITLE", szFileName, bHistory, FALSE, NULL))
{
nStatus = ERR_SUCCESS;
goto ret;
}
/* Open the backup file */
fBackup = CreateFile (szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (fBackup == INVALID_HANDLE_VALUE)
{
nStatus = ERR_OS_ERROR;
goto error;
}
// Determine size of the backup file
LARGE_INTEGER backupSize;
if (!GetFileSizeEx (fBackup, &backupSize))
{
nStatus = ERR_OS_ERROR;
goto error;
}
- CreateFullVolumePath (szDiskFile, lpszVolume, &bDevice);
+ CreateFullVolumePath (szDiskFile, sizeof(szDiskFile), lpszVolume, &bDevice);
if (bDevice == FALSE)
- strcpy (szCFDevice, szDiskFile);
+ StringCbCopyA (szCFDevice, sizeof(szCFDevice), szDiskFile);
else
{
- nDosLinkCreated = FakeDosNameForDevice (szDiskFile, szDosDevice, szCFDevice, FALSE);
+ nDosLinkCreated = FakeDosNameForDevice (szDiskFile, szDosDevice, sizeof(szDosDevice),szCFDevice, sizeof(szCFDevice),FALSE);
if (nDosLinkCreated != 0)
goto error;
}
// Open the volume
dev = CreateFile (szCFDevice, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (dev == INVALID_HANDLE_VALUE)
{
nStatus = ERR_OS_ERROR;
goto error;
}
// Determine volume host size
if (bDevice)
{
PARTITION_INFORMATION diskInfo;
DWORD dwResult;
BOOL bResult;
@@ -8285,46 +8315,46 @@ static BOOL CALLBACK SecurityTokenPreferencesDlgProc (HWND hwndDlg, UINT msg, WP return 1;
case IDOK:
{
char securityTokenLibraryPath[MAX_PATH];
GetDlgItemText (hwndDlg, IDC_PKCS11_MODULE, securityTokenLibraryPath, sizeof (securityTokenLibraryPath));
if (securityTokenLibraryPath[0] == 0)
{
try
{
SecurityToken::CloseLibrary();
}
catch (...) { }
SecurityTokenLibraryPath[0] = 0;
}
else
{
char prevSecurityTokenLibraryPath[MAX_PATH];
- strcpy (prevSecurityTokenLibraryPath, SecurityTokenLibraryPath);
- strcpy (SecurityTokenLibraryPath, securityTokenLibraryPath);
+ StringCbCopyA (prevSecurityTokenLibraryPath, sizeof(prevSecurityTokenLibraryPath), SecurityTokenLibraryPath);
+ StringCbCopyA (SecurityTokenLibraryPath, sizeof(SecurityTokenLibraryPath), securityTokenLibraryPath);
if (!InitSecurityTokenLibrary())
{
- strcpy (SecurityTokenLibraryPath, prevSecurityTokenLibraryPath);
+ StringCbCopyA (SecurityTokenLibraryPath, sizeof(SecurityTokenLibraryPath), prevSecurityTokenLibraryPath);
return 1;
}
}
CloseSecurityTokenSessionsAfterMount = (IsDlgButtonChecked (hwndDlg, IDC_CLOSE_TOKEN_SESSION_AFTER_MOUNT) == BST_CHECKED);
WaitCursor ();
SaveSettings (hwndDlg);
NormalCursor ();
EndDialog (hwndDlg, lw);
return 1;
}
case IDC_AUTO_DETECT_PKCS11_MODULE:
{
char systemDir[MAX_PATH];
GetSystemDirectory (systemDir, sizeof (systemDir));
WIN32_FIND_DATA findData;
bool found = false;
@@ -8376,41 +8406,41 @@ static BOOL CALLBACK SecurityTokenPreferencesDlgProc (HWND hwndDlg, UINT msg, WP if (find != INVALID_HANDLE_VALUE)
FindClose (find);
NormalCursor();
if (!found)
Warning ("PKCS11_MODULE_AUTO_DETECTION_FAILED");
return 1;
}
case IDC_SELECT_PKCS11_MODULE:
{
char securityTokenLibraryPath[MAX_PATH];
char systemDir[MAX_PATH];
wchar_t browseFilter[1024];
Info ("SELECT_PKCS11_MODULE_HELP");
- wsprintfW (browseFilter, L"%ls (*.dll)%c*.dll%c%c", GetString ("DLL_FILES"), 0, 0, 0);
+ StringCbPrintfW (browseFilter, sizeof(browseFilter), L"%ls (*.dll)%c*.dll%c%c", GetString ("DLL_FILES"), 0, 0, 0);
GetSystemDirectory (systemDir, sizeof (systemDir));
if (BrowseFilesInDir (hwndDlg, "SELECT_PKCS11_MODULE", systemDir, securityTokenLibraryPath, TRUE, FALSE, browseFilter))
SetDlgItemText (hwndDlg, IDC_PKCS11_MODULE, securityTokenLibraryPath);
return 1;
}
}
return 0;
}
return 0;
}
void SecurityTokenPreferencesDialog (HWND hwndDlg)
{
DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_TOKEN_PREFERENCES), hwndDlg, (DLGPROC) SecurityTokenPreferencesDlgProc, 0);
}
diff --git a/src/Mount/Mount.h b/src/Mount/Mount.h index 140b3e99..7509542c 100644 --- a/src/Mount/Mount.h +++ b/src/Mount/Mount.h @@ -77,39 +77,39 @@ void ExtractCommandLine ( HWND hwndDlg , char *lpszCommandLine ); static void WipeCache (HWND hwndDlg, BOOL silent);
void OpenVolumeExplorerWindow (int driveNo);
BOOL TaskBarIconAdd (HWND hwnd);
BOOL TaskBarIconRemove (HWND hwnd);
BOOL TaskBarIconChange (HWND hwnd, int iconId);
void DismountIdleVolumes ();
static void SaveDefaultKeyFilesParam (void);
static BOOL Dismount (HWND hwndDlg, int nDosDriveNo);
static BOOL DismountAll (HWND hwndDlg, BOOL forceUnmount, BOOL interact, int dismountMaxRetries, int dismountAutoRetryDelay);
static void KeyfileDefaultsDlg (HWND hwndDlg);
static void HandleHotKey (HWND hwndDlg, WPARAM wParam);
static BOOL CheckMountList ();
int GetCipherBlockSizeByDriveNo (int nDosDriveNo);
int GetModeOfOperationByDriveNo (int nDosDriveNo);
void ChangeMainWindowVisibility ();
void LaunchVolCreationWizard (HWND hwndDlg);
BOOL WholeSysDriveEncryption (BOOL bSilent);
BOOL CheckSysEncMountWithoutPBA (const char *devicePath, BOOL quiet);
BOOL TCBootLoaderOnInactiveSysEncDrive (void);
void CreateRescueDisk (void);
-int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, char *lpszVolume);
-int RestoreVolumeHeader (HWND hwndDlg, char *lpszVolume);
+int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const char *lpszVolume);
+int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume);
void SecurityTokenPreferencesDialog (HWND hwndDlg);
static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions);
uint32 ReadDriverConfigurationFlags ();
void AnalyzeKernelMiniDump (HWND hwndDlg);
void HookMouseWheel (HWND hwndDlg, UINT ctrlId);
static BOOL HandleDriveListMouseWheelEvent (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL bListMustBePointed);
#ifdef __cplusplus
}
void SetDriverConfigurationFlag (uint32 flag, BOOL state);
BOOL MountFavoriteVolumes (BOOL systemFavorites = FALSE, BOOL logOnMount = FALSE, BOOL hotKeyMount = FALSE, const VeraCrypt::FavoriteVolume &favoriteVolumeToMount = VeraCrypt::FavoriteVolume());
BOOL GetExecutableImageInformation (const string &path, string &version, string &description, string &companyName, string &productName);
#endif
|