VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2023-09-03 16:47:41 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2023-09-03 16:47:41 +0200
commit201d09ff5aa69db61643659726b36810d5ac00d4 (patch)
tree7e125fa95b059a7cc5272086ab9ed93defbb878c
parentd68b9546bd36fa34093b8592d3927ba581fc8e59 (diff)
downloadVeraCrypt-201d09ff5aa69db61643659726b36810d5ac00d4.tar.gz
VeraCrypt-201d09ff5aa69db61643659726b36810d5ac00d4.zip
Windows: remove legacy code (XP, Vista). Simplify code since Windows 7 is now minimal OS version.
-rw-r--r--src/Common/BootEncryption.cpp36
-rw-r--r--src/Common/Dlgcode.c191
-rw-r--r--src/Common/Format.c2
-rw-r--r--src/Format/Tcformat.c67
-rw-r--r--src/Mount/Mount.c60
-rw-r--r--src/Setup/Setup.c57
-rw-r--r--src/SetupDLL/Setup.c34
7 files changed, 130 insertions, 317 deletions
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index 189d5a78..752fac01 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -1148,7 +1148,7 @@ namespace VeraCrypt
if (partition.Info.PartitionNumber != config.SystemPartition.Number)
{
// If there is an extra boot partition, the system partition must be located right behind it
- if (IsOSAtLeast (WIN_7) && config.ExtraBootPartitionPresent)
+ if (config.ExtraBootPartitionPresent)
{
int64 minOffsetFound = config.DrivePartition.Info.PartitionLength.QuadPart;
Partition bootPartition = partition;
@@ -1276,32 +1276,9 @@ namespace VeraCrypt
finally_do_arg (SC_HANDLE, service, { CloseServiceHandle (finally_arg); });
- // Windows versions preceding Vista can be installed on FAT filesystem which does not
- // support long filenames during boot. Convert the driver path to short form if required.
- wstring driverPath;
- if (startOnBoot && !IsOSAtLeast (WIN_VISTA))
- {
- wchar_t pathBuf[MAX_PATH];
- wchar_t filesystem[128];
-
- wstring path (GetWindowsDirectory());
- path += L"\\drivers\\veracrypt.sys";
-
- if (GetVolumePathName (path.c_str(), pathBuf, ARRAYSIZE (pathBuf))
- && GetVolumeInformation (pathBuf, NULL, 0, NULL, NULL, NULL, filesystem, ARRAYSIZE(filesystem))
- && wmemcmp (filesystem, L"FAT", 3) == 0)
- {
- throw_sys_if (GetShortPathName (path.c_str(), pathBuf, ARRAYSIZE (pathBuf)) == 0);
-
- // Convert absolute path to relative to the Windows directory
- driverPath = pathBuf;
- driverPath = driverPath.substr (driverPath.rfind (L"\\", driverPath.rfind (L"\\", driverPath.rfind (L"\\") - 1) - 1) + 1);
- }
- }
-
throw_sys_if (!ChangeServiceConfig (service, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE,
startOnBoot ? SERVICE_ERROR_SEVERE : SERVICE_ERROR_NORMAL,
- driverPath.empty() ? NULL : driverPath.c_str(),
+ NULL,
startOnBoot ? L"Filter" : NULL,
NULL, NULL, NULL, NULL, NULL));
@@ -1661,8 +1638,7 @@ namespace VeraCrypt
{
SystemDriveConfiguration config = GetSystemDriveConfiguration();
- if (IsOSAtLeast (WIN_7)
- && config.Partitions.size() == 2
+ if (config.Partitions.size() == 2
&& config.ExtraBootPartitionPresent
&& config.DrivePartition.Info.PartitionLength.QuadPart - config.SystemPartition.Info.PartitionLength.QuadPart < 164 * BYTES_PER_MB)
{
@@ -1838,8 +1814,7 @@ namespace VeraCrypt
*(uint16 *) (buffer + TC_BOOT_SECTOR_VERSION_OFFSET) = BE16 (VERSION_NUM);
- if (IsOSAtLeast (WIN_VISTA))
- buffer[TC_BOOT_SECTOR_CONFIG_OFFSET] |= TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER;
+ buffer[TC_BOOT_SECTOR_CONFIG_OFFSET] |= TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER;
if (rescueDisk && (ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION))
buffer[TC_BOOT_SECTOR_CONFIG_OFFSET] |= TC_BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION;
@@ -4745,9 +4720,6 @@ namespace VeraCrypt
break;
case DumpFilter:
- if (!IsOSAtLeast (WIN_VISTA))
- return;
-
filter = "veracrypt.sys";
filterReg = "DumpFilters";
SetLastError (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\CrashControl", 0, KEY_READ | KEY_WRITE, &regKey));
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index de23d8b1..c9c9752a 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -2243,7 +2243,7 @@ void InitDialog (HWND hwndDlg)
{
StringCbCopyW ((WCHAR *)metric.lfMessageFont.lfFaceName, sizeof (metric.lfMessageFont.lfFaceName), font->FaceName);
}
- else if (IsOSAtLeast (WIN_VISTA))
+ else
{
// Vista's new default font (size and spacing) breaks compatibility with Windows 2k/XP applications.
// Force use of Tahoma (as Microsoft does in many dialogs) until a native Vista look is implemented.
@@ -3570,9 +3570,9 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
}
#else
// in TESTSIGNING mode, we support only Windows 7 and Windows 8/8.1
- if ( !IsOSVersionAtLeast(WIN_7, 0)
+ if (
#ifndef SETUP
- || IsOSVersionAtLeast(WIN_10, 0)
+ IsOSVersionAtLeast(WIN_10, 0)
#else
|| (IsOSVersionAtLeast(WIN_10, 0) && !bMakePackage)
#endif
@@ -3637,14 +3637,11 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
#ifndef SETUP
#ifdef _WIN64
- if (IsOSAtLeast (WIN_7))
+ EnableRamEncryption ((ReadDriverConfigurationFlags() & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION) ? TRUE : FALSE);
+ if (IsRamEncryptionEnabled())
{
- EnableRamEncryption ((ReadDriverConfigurationFlags() & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION) ? TRUE : FALSE);
- if (IsRamEncryptionEnabled())
- {
- if (!InitializeSecurityParameters(GetAppRandomSeed))
- AbortProcess("OUTOFMEMORY");
- }
+ if (!InitializeSecurityParameters(GetAppRandomSeed))
+ AbortProcess("OUTOFMEMORY");
}
#endif
if (!EncryptionThreadPoolStart (ReadEncryptionThreadPoolFreeCpuCountLimit()))
@@ -3790,24 +3787,21 @@ BOOL GetSysDevicePaths (HWND hwndDlg)
StringCchCopyW (device.IsPartition ? SysPartitionDevicePath : SysDriveDevicePath, TC_MAX_PATH, device.Path.c_str());
}
- if (IsOSAtLeast (WIN_7))
+ // Find extra boot partition
+ foreach (const HostDevice &drive, GetAvailableHostDevices (false, false))
{
- // Find extra boot partition
- foreach (const HostDevice &drive, GetAvailableHostDevices (false, false))
+ if (drive.ContainsSystem)
{
- if (drive.ContainsSystem)
+ foreach (const HostDevice &sysDrivePartition, drive.Partitions)
{
- foreach (const HostDevice &sysDrivePartition, drive.Partitions)
+ if (sysDrivePartition.Bootable)
{
- if (sysDrivePartition.Bootable)
- {
- if (sysDrivePartition.Size <= TC_MAX_EXTRA_BOOT_PARTITION_SIZE)
- ExtraBootPartitionDevicePath = sysDrivePartition.Path;
- break;
- }
+ if (sysDrivePartition.Size <= TC_MAX_EXTRA_BOOT_PARTITION_SIZE)
+ ExtraBootPartitionDevicePath = sysDrivePartition.Path;
+ break;
}
- break;
}
+ break;
}
}
@@ -7970,7 +7964,7 @@ void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap)
eventId = SHCNE_DRIVEADD;
else if (message == DBT_DEVICEREMOVECOMPLETE)
eventId = SHCNE_DRIVEREMOVED;
- else if (IsOSAtLeast (WIN_7) && message == DBT_DEVICEREMOVEPENDING) // Explorer on Windows 7 holds open handles of all drives when 'Computer' is expanded in navigation pane. SHCNE_DRIVEREMOVED must be used as DBT_DEVICEREMOVEPENDING is ignored.
+ else if (message == DBT_DEVICEREMOVEPENDING) // Explorer on Windows 7 holds open handles of all drives when 'Computer' is expanded in navigation pane. SHCNE_DRIVEREMOVED must be used as DBT_DEVICEREMOVEPENDING is ignored.
eventId = SHCNE_DRIVEREMOVED;
if (driveMap == 0)
@@ -8531,47 +8525,44 @@ retry:
mount.BytesPerPhysicalSector = bps;
}
- if (IsOSAtLeast (WIN_VISTA))
+ if ( (wcslen(root) >= 2)
+ && (root[1] == L':')
+ && (towupper(root[0]) >= L'A' && towupper(root[0]) <= L'Z')
+ )
{
- if ( (wcslen(root) >= 2)
- && (root[1] == L':')
- && (towupper(root[0]) >= L'A' && towupper(root[0]) <= L'Z')
- )
- {
- wstring drivePath = L"\\\\.\\X:";
- HANDLE dev = INVALID_HANDLE_VALUE;
- VOLUME_DISK_EXTENTS extents = {0};
- DWORD dwResult = 0;
- drivePath[4] = root[0];
+ wstring drivePath = L"\\\\.\\X:";
+ HANDLE dev = INVALID_HANDLE_VALUE;
+ VOLUME_DISK_EXTENTS extents = {0};
+ DWORD dwResult = 0;
+ drivePath[4] = root[0];
- if ((dev = CreateFile (drivePath.c_str(),0, 0, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
+ if ((dev = CreateFile (drivePath.c_str(),0, 0, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
+ {
+ if (DeviceIoControl (dev, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, &extents, sizeof(extents), &dwResult, NULL))
{
- if (DeviceIoControl (dev, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, &extents, sizeof(extents), &dwResult, NULL))
+ if (extents.NumberOfDiskExtents > 0)
{
- if (extents.NumberOfDiskExtents > 0)
+ STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR accessDesc;
+ STORAGE_ADAPTER_DESCRIPTOR adapterDesc;
+
+ if (GetPhysicalDriveStorageInformation (extents.Extents[0].DiskNumber, &accessDesc, &adapterDesc))
{
- STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR accessDesc;
- STORAGE_ADAPTER_DESCRIPTOR adapterDesc;
+ if (accessDesc.Size >= sizeof (STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR))
+ {
+ mount.BytesPerSector = accessDesc.BytesPerLogicalSector;
+ mount.BytesPerPhysicalSector = accessDesc.BytesPerPhysicalSector;
+ }
- if (GetPhysicalDriveStorageInformation (extents.Extents[0].DiskNumber, &accessDesc, &adapterDesc))
+ if (adapterDesc.Size >= sizeof (STORAGE_ADAPTER_DESCRIPTOR))
{
- if (accessDesc.Size >= sizeof (STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR))
- {
- mount.BytesPerSector = accessDesc.BytesPerLogicalSector;
- mount.BytesPerPhysicalSector = accessDesc.BytesPerPhysicalSector;
- }
-
- if (adapterDesc.Size >= sizeof (STORAGE_ADAPTER_DESCRIPTOR))
- {
- mount.MaximumTransferLength = adapterDesc.MaximumTransferLength;
- mount.MaximumPhysicalPages = adapterDesc.MaximumPhysicalPages;
- mount.AlignmentMask = adapterDesc.AlignmentMask;
- }
+ mount.MaximumTransferLength = adapterDesc.MaximumTransferLength;
+ mount.MaximumPhysicalPages = adapterDesc.MaximumPhysicalPages;
+ mount.AlignmentMask = adapterDesc.AlignmentMask;
}
}
}
- CloseHandle (dev);
}
+ CloseHandle (dev);
}
}
@@ -8874,12 +8865,9 @@ retry:
goto retry;
}
- if (IsOSAtLeast (WIN_7))
- {
- // Undo SHCNE_DRIVEREMOVED
- wchar_t root[] = { (wchar_t) nDosDriveNo + L'A', L':', L'\\', 0 };
- SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
- }
+ // Undo SHCNE_DRIVEREMOVED
+ wchar_t root[] = { (wchar_t) nDosDriveNo + L'A', L':', L'\\', 0 };
+ SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
return FALSE;
}
@@ -9079,9 +9067,6 @@ BOOL IsUacSupported ()
HKEY hkey;
DWORD value = 1, size = sizeof (DWORD);
- if (!IsOSAtLeast (WIN_VISTA))
- return FALSE;
-
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 0, KEY_READ, &hkey) == ERROR_SUCCESS)
{
if (RegQueryValueEx (hkey, L"EnableLUA", 0, 0, (LPBYTE) &value, &size) != ERROR_SUCCESS)
@@ -9748,12 +9733,12 @@ void CleanLastVisitedMRU (void)
GetModuleFileNameW (NULL, exeFilename, sizeof (exeFilename) / sizeof(exeFilename[0]));
strToMatch = wcsrchr (exeFilename, L'\\') + 1;
- StringCbPrintfW (regPath, sizeof(regPath), L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisited%sMRU", IsOSAtLeast (WIN_VISTA) ? L"Pidl" : L"");
+ StringCbCopyW (regPath, sizeof(regPath), L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU");
- for (id = (IsOSAtLeast (WIN_VISTA) ? 0 : L'a'); id <= (IsOSAtLeast (WIN_VISTA) ? 1000 : L'z'); id++)
+ for (id = 0; id <= 1000; id++)
{
*strTmp = 0;
- StringCbPrintfW (key, sizeof(key), (IsOSAtLeast (WIN_VISTA) ? L"%d" : L"%c"), id);
+ StringCbPrintfW (key, sizeof(key), L"%d", id);
if ((len = ReadRegistryBytes (regPath, key, (char *) strTmp, sizeof (strTmp))) > 0)
{
@@ -9769,48 +9754,26 @@ void CleanLastVisitedMRU (void)
DeleteRegistryValue (regPath, key);
// Remove ID from MRUList
- if (IsOSAtLeast (WIN_VISTA))
- {
- int *p = (int *)buf;
- int *pout = (int *)bufout;
- int l;
+ int *p = (int *)buf;
+ int *pout = (int *)bufout;
+ int l;
- l = len = ReadRegistryBytes (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU", L"MRUListEx", buf, sizeof (buf));
- while (l > 0)
- {
- l -= sizeof (int);
-
- if (*p == id)
- {
- p++;
- len -= sizeof (int);
- continue;
- }
- *pout++ = *p++;
- }
-
- WriteRegistryBytes (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU", L"MRUListEx", bufout, len);
- }
- else
+ l = len = ReadRegistryBytes (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU", L"MRUListEx", buf, sizeof (buf));
+ while (l > 0)
{
- wchar_t *p = (wchar_t*) buf;
- wchar_t *pout = (wchar_t*) bufout;
+ l -= sizeof (int);
- ReadRegistryString (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedMRU", L"MRUList", L"", (wchar_t*) buf, sizeof (buf));
- while (*p)
+ if (*p == id)
{
- if (*p == id)
- {
- p++;
- continue;
- }
- *pout++ = *p++;
+ p++;
+ len -= sizeof (int);
+ continue;
}
- *pout++ = 0;
-
- WriteRegistryString (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedMRU", L"MRUList", (wchar_t*) bufout);
+ *pout++ = *p++;
}
+ WriteRegistryBytes (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU", L"MRUListEx", bufout, len);
+
break;
}
}
@@ -9991,7 +9954,7 @@ void TaskBarIconDisplayBalloonTooltip (HWND hwnd, wchar_t *headline, wchar_t *te
tnid.uFlags = NIF_INFO;
tnid.dwInfoFlags = (warning ? NIIF_WARNING : NIIF_INFO);
- tnid.uTimeout = (IsOSAtLeast (WIN_VISTA) ? 1000 : 5000); // in ms
+ tnid.uTimeout = 1000; // in ms
StringCbCopyW (tnid.szInfoTitle, sizeof(tnid.szInfoTitle), headline);
StringCbCopyW (tnid.szInfo, sizeof(tnid.szInfo),text);
@@ -11024,7 +10987,7 @@ void Applink (const char *dest)
CorrectURL (url);
}
- if (IsOSAtLeast (WIN_VISTA) && IsAdmin ())
+ if (IsAdmin ())
{
int openDone = 0;
if (buildUrl)
@@ -11106,8 +11069,6 @@ void HandleDriveNotReadyError (HWND hwnd)
{
Warning ("SYS_AUTOMOUNT_DISABLED", hwnd);
}
- else if (nCurrentOS == WIN_VISTA && CurrentOSServicePack < 1)
- Warning ("SYS_ASSIGN_DRIVE_LETTER", hwnd);
else
Warning ("DEVICE_NOT_READY_ERROR", hwnd);
@@ -13016,11 +12977,6 @@ BOOL IsWindowsIsoBurnerAvailable ()
{
wchar_t path[MAX_PATH*2] = { 0 };
- if (!IsOSAtLeast (WIN_7))
- {
- return FALSE;
- }
-
if (SUCCEEDED(SHGetFolderPath (NULL, CSIDL_SYSTEM, NULL, 0, path)))
{
StringCbCatW (path, MAX_PATH*2, L"\\" ISO_BURNER_TOOL);
@@ -13346,16 +13302,13 @@ void ProcessEntropyEstimate (HWND hProgress, DWORD* pdwInitialValue, DWORD dwCou
else
*pdwEntropy = dwMaxLevel;
- if (IsOSAtLeast (WIN_VISTA))
- {
- int state = PBST_ERROR;
- if (*pdwEntropy >= (dwMaxLevel/2))
- state = PBST_NORMAL;
- else if (*pdwEntropy >= (dwMaxLevel/4))
- state = PBST_PAUSED;
+ int state = PBST_ERROR;
+ if (*pdwEntropy >= (dwMaxLevel/2))
+ state = PBST_NORMAL;
+ else if (*pdwEntropy >= (dwMaxLevel/4))
+ state = PBST_PAUSED;
- SendMessage (hProgress, PBM_SETSTATE, state, 0);
- }
+ SendMessage (hProgress, PBM_SETSTATE, state, 0);
SendMessage (hProgress, PBM_SETPOS,
(WPARAM) (*pdwEntropy),
@@ -14351,7 +14304,7 @@ HRESULT ShellExecInExplorerProcess(PCWSTR pszFile)
void SafeOpenURL (LPCWSTR szUrl)
{
BOOL bFallback = TRUE;
- if (IsOSAtLeast (WIN_VISTA) && IsUacSupported() && IsAdmin () && IsElevated() && GetShellWindow())
+ if (IsUacSupported() && IsAdmin () && IsElevated() && GetShellWindow())
{
WCHAR szRunDllPath[TC_MAX_PATH];
WCHAR szUrlDllPath[TC_MAX_PATH];
diff --git a/src/Common/Format.c b/src/Common/Format.c
index 334bff3d..4d8dfed9 100644
--- a/src/Common/Format.c
+++ b/src/Common/Format.c
@@ -218,7 +218,7 @@ begin_format:
bFailedRequiredDASD = TRUE;
}
}
- else if (IsOSAtLeast (WIN_VISTA) && driveLetter == -1)
+ else if (driveLetter == -1)
{
// Windows Vista doesn't allow overwriting sectors belonging to an unformatted partition
// to which no drive letter has been assigned under the system. This problem can be worked
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index bf9f9854..f8b466af 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -1106,24 +1106,6 @@ BOOL SwitchWizardToSysEncMode (void)
if (AskWarnYesNoString ((wstring (GetString ("SYSDRIVE_NON_STANDARD_PARTITIONS")) + L"\n\n" + GetString ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE")).c_str(), MainDlg) == IDYES)
bWholeSysDrive = FALSE;
}
-
- if (!IsOSAtLeast (WIN_VISTA) && bWholeSysDrive)
- {
- if (BootEncObj->SystemDriveContainsExtendedPartition())
- {
- bWholeSysDrive = FALSE;
-
- Error ("WDE_UNSUPPORTED_FOR_EXTENDED_PARTITIONS", MainDlg);
-
- if (AskYesNo ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE", MainDlg) == IDNO)
- {
- ChangeWizardMode (WIZARD_MODE_NONSYS_DEVICE);
- return FALSE;
- }
- }
- else
- Warning ("WDE_EXTENDED_PARTITIONS_WARNING", MainDlg);
- }
}
else if (BootEncObj->SystemPartitionCoversWholeDrive()
&& !bWholeSysDrive)
@@ -5102,7 +5084,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
//exFAT support added starting from Vista SP1
- if (IsOSVersionAtLeast (WIN_VISTA, 1) && dataAreaSize >= TC_MIN_EXFAT_FS_SIZE && dataAreaSize <= TC_MAX_EXFAT_FS_SIZE)
+ if (dataAreaSize >= TC_MIN_EXFAT_FS_SIZE && dataAreaSize <= TC_MAX_EXFAT_FS_SIZE)
{
AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"exFAT", FILESYS_EXFAT);
bEXFATallowed = TRUE;
@@ -6424,13 +6406,6 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
}
- /* Verify that the volume would not be too large for the operating system */
- if (!IsOSAtLeast (WIN_VISTA)
- && nVolumeSize > 2 * BYTES_PER_TB)
- {
- AbortProcess ("VOLUME_TOO_LARGE_FOR_WINXP");
- }
-
if (volumePassword.Length > 0)
{
// Check password length (check also done for outer volume which is not the case in TrueCrypt).
@@ -6456,12 +6431,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else
StringCbCatW (szRescueDiskISO, sizeof(szRescueDiskISO), L"\\VeraCrypt Rescue Disk.iso");
- if (IsOSAtLeast (WIN_VISTA))
- {
- // Availability of in-place encryption (which is pre-selected by default whenever
- // possible) makes partition-hosted volume creation safer.
- bWarnDeviceFormatAdvanced = FALSE;
- }
+ // Availability of in-place encryption (which is pre-selected by default whenever
+ // possible) makes partition-hosted volume creation safer.
+ bWarnDeviceFormatAdvanced = FALSE;
#ifdef _DEBUG
// For faster testing
@@ -7238,21 +7210,6 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (AskWarnYesNoString ((wstring (GetString ("SYSDRIVE_NON_STANDARD_PARTITIONS")) + L"\n\n" + GetString ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE")).c_str(), MainDlg) == IDYES)
bWholeSysDrive = FALSE;
}
-
- if (!IsOSAtLeast (WIN_VISTA) && bWholeSysDrive)
- {
- if (BootEncObj->SystemDriveContainsExtendedPartition())
- {
- Error ("WDE_UNSUPPORTED_FOR_EXTENDED_PARTITIONS", MainDlg);
-
- if (AskYesNo ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE", MainDlg) == IDNO)
- return 1;
-
- bWholeSysDrive = FALSE;
- }
- else
- Warning ("WDE_EXTENDED_PARTITIONS_WARNING", hwndDlg);
- }
}
if (!bWholeSysDrive && BootEncObj->SystemPartitionCoversWholeDrive())
@@ -7310,8 +7267,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (bHiddenOS)
{
- if (IsOSAtLeast (WIN_7)
- && BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent
+ if (BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent
&& AskWarnYesNo ("CONFIRM_HIDDEN_OS_EXTRA_BOOT_PARTITION", hwndDlg) == IDNO)
{
TextInfoDialogBox (TC_TBXID_EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS);
@@ -7680,13 +7636,6 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
}
- /* Verify that the volume would not be too large for the operating system */
-
- if (!IsOSAtLeast (WIN_VISTA)
- && nUIVolumeSize * nMultiplier > 2 * BYTES_PER_TB)
- {
- Warning ("VOLUME_TOO_LARGE_FOR_WINXP", hwndDlg);
- }
}
if (bHiddenVol && !bHiddenVolHost) // If it's a hidden volume
@@ -9289,7 +9238,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
CmdVolumeFilesystem = FILESYS_FAT;
else if (_wcsicmp(szTmp, L"NTFS") == 0)
CmdVolumeFilesystem = FILESYS_NTFS;
- else if (IsOSVersionAtLeast (WIN_VISTA, 1) && _wcsicmp(szTmp, L"EXFAT") == 0)
+ else if (_wcsicmp(szTmp, L"EXFAT") == 0)
CmdVolumeFilesystem = FILESYS_EXFAT;
else if (IsOSVersionAtLeast (WIN_10, 0) && _wcsicmp(szTmp, L"ReFS") == 0)
CmdVolumeFilesystem = FILESYS_REFS;
@@ -10650,10 +10599,6 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
InitApp (hInstance, lpszCommandLine);
- // Write block size greater than 64 KB causes a performance drop when writing to files on XP/Vista
- if (!IsOSAtLeast (WIN_7))
- FormatWriteBufferSize = 64 * 1024;
-
#if TC_MAX_VOLUME_SECTOR_SIZE > 64 * 1024
#error TC_MAX_VOLUME_SECTOR_SIZE > 64 * 1024
#endif
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 52ee632f..a5ef45de 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -5565,21 +5565,18 @@ retry:
goto retry;
}
- if (IsOSAtLeast (WIN_7))
+ // Undo SHCNE_DRIVEREMOVED
+ if ( DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, NULL, 0, &mountList, sizeof (mountList), &dwResult, NULL)
+ && mountList.ulMountedDrives
+ && (mountList.ulMountedDrives < (1 << 26))
+ )
{
- // Undo SHCNE_DRIVEREMOVED
- if ( DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, NULL, 0, &mountList, sizeof (mountList), &dwResult, NULL)
- && mountList.ulMountedDrives
- && (mountList.ulMountedDrives < (1 << 26))
- )
+ for (i = 0; i < 26; i++)
{
- for (i = 0; i < 26; i++)
+ if (mountList.ulMountedDrives & (1 << i))
{
- if (mountList.ulMountedDrives & (1 << i))
- {
- wchar_t root[] = { (wchar_t) i + L'A', L':', L'\\', 0 };
- SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
- }
+ wchar_t root[] = { (wchar_t) i + L'A', L':', L'\\', 0 };
+ SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
}
}
}
@@ -9937,8 +9934,7 @@ static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
memset (&SystemFavoritesServiceStatus, 0, sizeof (SystemFavoritesServiceStatus));
SystemFavoritesServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
SystemFavoritesServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
- if (IsOSAtLeast (WIN_VISTA))
- SystemFavoritesServiceStatus.dwControlsAccepted |= SERVICE_ACCEPT_PRESHUTDOWN | SERVICE_ACCEPT_SESSIONCHANGE | SERVICE_ACCEPT_POWEREVENT;
+ SystemFavoritesServiceStatus.dwControlsAccepted |= SERVICE_ACCEPT_PRESHUTDOWN | SERVICE_ACCEPT_SESSIONCHANGE | SERVICE_ACCEPT_POWEREVENT;
for (i = 1; i < argc; i++)
{
@@ -11605,7 +11601,7 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
EnableWindow (GetDlgItem (hwndDlg, IDC_ENABLE_CPU_RNG), FALSE);
}
- if (IsOSAtLeast (WIN_7) && IsRamEncryptionSupported())
+ if (IsRamEncryptionSupported())
{
CheckDlgButton (hwndDlg, IDC_ENABLE_RAM_ENCRYPTION, (driverConfig & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION) ? BST_CHECKED : BST_UNCHECKED);
}
@@ -11717,32 +11713,30 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
if (IsOSAtLeast (WIN_8_1))
SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ALLOW_WINDOWS_DEFRAG, allowWindowsDefrag);
SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ENABLE_CPU_RNG, enableCpuRng);
- if (IsOSAtLeast (WIN_7))
+
+ BOOL originalRamEncryptionEnabled = (driverConfig & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION)? TRUE : FALSE;
+ if (originalRamEncryptionEnabled != enableRamEncryption)
{
- BOOL originalRamEncryptionEnabled = (driverConfig & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION)? TRUE : FALSE;
- if (originalRamEncryptionEnabled != enableRamEncryption)
+ if (enableRamEncryption)
{
- if (enableRamEncryption)
+ // Disable Hibernate and Fast Startup if they are enabled
+ BOOL bHibernateEnabled, bHiberbootEnabled;
+ if (GetHibernateStatus (bHibernateEnabled, bHiberbootEnabled))
{
- // Disable Hibernate and Fast Startup if they are enabled
- BOOL bHibernateEnabled, bHiberbootEnabled;
- if (GetHibernateStatus (bHibernateEnabled, bHiberbootEnabled))
- {
- if (bHibernateEnabled)
- {
- BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Power", L"HibernateEnabled", 0);
- }
+ if (bHibernateEnabled)
+ {
+ BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Power", L"HibernateEnabled", 0);
+ }
- if (bHiberbootEnabled)
- {
- BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power", L"HiberbootEnabled", 0);
- }
+ if (bHiberbootEnabled)
+ {
+ BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power", L"HiberbootEnabled", 0);
}
}
- rebootRequired = true;
}
- SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION, enableRamEncryption);
+ rebootRequired = true;
}
+ SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION, enableRamEncryption);
DWORD bytesReturned;
if (!DeviceIoControl (hDriver, TC_IOCTL_REREAD_DRIVER_CONFIG, NULL, 0, NULL, 0, &bytesReturned, NULL))
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index e505bb05..2d8d940c 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -570,26 +570,13 @@ BOOL IsSystemRestoreEnabled ()
GetRestorePointRegKeyName (szRegPath, sizeof (szRegPath));
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, szRegPath, 0, KEY_READ | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS)
{
- if (IsOSAtLeast (WIN_VISTA))
- {
- if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
- && (dwValue == 1)
- )
- {
- bEnabled = TRUE;
- }
- }
- else
+ if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
+ && (dwValue == 1)
+ )
{
- if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"DisableSR", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
- && (dwValue == 0)
- )
- {
- bEnabled = TRUE;
- }
+ bEnabled = TRUE;
}
-
RegCloseKey (hKey);
}
@@ -1357,13 +1344,10 @@ error:
}
// Register COM servers for UAC
- if (IsOSAtLeast (WIN_VISTA))
+ if (!RegisterComServers (szDir))
{
- if (!RegisterComServers (szDir))
- {
- Error ("COM_REG_FAILED", hwndDlg);
- return FALSE;
- }
+ Error ("COM_REG_FAILED", hwndDlg);
+ return FALSE;
}
return bOK;
@@ -1436,16 +1420,9 @@ BOOL DoApplicationDataUninstall (HWND hwndDlg)
BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated)
{
wchar_t regk [64];
- typedef LSTATUS (WINAPI *RegDeleteKeyExWFn) (HKEY hKey,LPCWSTR lpSubKey,REGSAM samDesired,WORD Reserved);
- RegDeleteKeyExWFn RegDeleteKeyExWPtr = NULL;
- HMODULE hAdvapiDll = LoadLibrary (L"Advapi32.dll");
- if (hAdvapiDll)
- {
- RegDeleteKeyExWPtr = (RegDeleteKeyExWFn) GetProcAddress(hAdvapiDll, "RegDeleteKeyExW");
- }
// Unregister COM servers
- if (!bRemoveDeprecated && IsOSAtLeast (WIN_VISTA))
+ if (!bRemoveDeprecated)
{
if (!UnregisterComServers (InstallationPath))
StatusMessage (hwndDlg, "COM_DEREG_FAILED");
@@ -1454,16 +1431,9 @@ BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated)
if (!bRemoveDeprecated)
StatusMessage (hwndDlg, "REMOVING_REG");
- if (RegDeleteKeyExWPtr)
- {
- RegDeleteKeyExWPtr (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", KEY_WOW64_32KEY, 0);
- RegDeleteKeyExWPtr (HKEY_CURRENT_USER, L"Software\\VeraCrypt", KEY_WOW64_32KEY, 0);
- }
- else
- {
- RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt");
- RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\VeraCrypt");
- }
+ RegDeleteKeyExW (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", KEY_WOW64_32KEY, 0);
+ RegDeleteKeyExW (HKEY_CURRENT_USER, L"Software\\VeraCrypt", KEY_WOW64_32KEY, 0);
+
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Classes\\VeraCryptVolume\\Shell\\open\\command");
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Classes\\VeraCryptVolume\\Shell\\open");
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Classes\\VeraCryptVolume\\Shell");
@@ -1502,9 +1472,6 @@ BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated)
SHChangeNotify (SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
}
- if (hAdvapiDll)
- FreeLibrary (hAdvapiDll);
-
return TRUE;
}
@@ -2879,7 +2846,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
if (!bUninstall)
{
- if (!bDevm && !LocalizationActive && (nCurrentOS >= WIN_VISTA))
+ if (!bDevm && !LocalizationActive)
{
BOOL bHasPreferredLanguage = (strlen (GetPreferredLangId ()) > 0)? TRUE : FALSE;
if ((IDCANCEL == DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_INSTALL_LANGUAGE), NULL, (DLGPROC) SelectLanguageDialogProc, (LPARAM) 0 ))
diff --git a/src/SetupDLL/Setup.c b/src/SetupDLL/Setup.c
index a4bf6520..6a288a5c 100644
--- a/src/SetupDLL/Setup.c
+++ b/src/SetupDLL/Setup.c
@@ -254,26 +254,13 @@ BOOL IsSystemRestoreEnabled ()
GetRestorePointRegKeyName (szRegPath, sizeof (szRegPath));
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, szRegPath, 0, KEY_READ | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS)
{
- if (IsOSAtLeast (WIN_VISTA))
- {
- if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
- && (dwValue == 1)
- )
- {
- bEnabled = TRUE;
- }
- }
- else
+ if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
+ && (dwValue == 1)
+ )
{
- if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"DisableSR", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
- && (dwValue == 0)
- )
- {
- bEnabled = TRUE;
- }
+ bEnabled = TRUE;
}
-
RegCloseKey (hKey);
}
@@ -882,8 +869,6 @@ void HandleDriveNotReadyError_Dll (MSIHANDLE hInstaller)
{
MSILogAndShow (hInstaller, MSI_WARNING_LEVEL, GetString("SYS_AUTOMOUNT_DISABLED"));
}
- else if (nCurrentOS == WIN_VISTA && CurrentOSServicePack < 1)
- MSILogAndShow (hInstaller, MSI_WARNING_LEVEL, GetString("SYS_ASSIGN_DRIVE_LETTER"));
else
MSILogAndShow (hInstaller, MSI_WARNING_LEVEL, GetString("DEVICE_NOT_READY_ERROR"));
@@ -1717,7 +1702,7 @@ BOOL DoRegUninstall_Dll (MSIHANDLE hInstaller, BOOL bRemoveDeprecated)
}
// Unregister COM servers
- if (!bRemoveDeprecated && IsOSAtLeast (WIN_VISTA))
+ if (!bRemoveDeprecated)
{
if (!UnregisterComServers (InstallationPath))
MSILog (hInstaller, MSI_ERROR_LEVEL, GetString("COM_DEREG_FAILED"));
@@ -2638,13 +2623,10 @@ EXTERN_C UINT STDAPICALLTYPE VC_CustomAction_PostInstall(MSIHANDLE hInstaller)
// Last part of DoRegInstall()
{
// Register COM servers for UAC
- if (IsOSAtLeast (WIN_VISTA))
+ if (!RegisterComServers ((wchar_t*)szInstallDir.c_str()))
{
- if (!RegisterComServers ((wchar_t*)szInstallDir.c_str()))
- {
- MSILogAndShow (hInstaller, MSI_ERROR_LEVEL, GetString("COM_REG_FAILED"));
- goto end;
- }
+ MSILogAndShow (hInstaller, MSI_ERROR_LEVEL, GetString("COM_REG_FAILED"));
+ goto end;
}
}