1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 02:58:02 -06:00

Windows: remove legacy code (XP, Vista). Simplify code since Windows 7 is now minimal OS version.

This commit is contained in:
Mounir IDRASSI
2023-09-03 16:47:41 +02:00
parent d68b9546bd
commit 201d09ff5a
7 changed files with 133 additions and 320 deletions

View File

@@ -1148,7 +1148,7 @@ namespace VeraCrypt
if (partition.Info.PartitionNumber != config.SystemPartition.Number) if (partition.Info.PartitionNumber != config.SystemPartition.Number)
{ {
// If there is an extra boot partition, the system partition must be located right behind it // 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; int64 minOffsetFound = config.DrivePartition.Info.PartitionLength.QuadPart;
Partition bootPartition = partition; Partition bootPartition = partition;
@@ -1276,32 +1276,9 @@ namespace VeraCrypt
finally_do_arg (SC_HANDLE, service, { CloseServiceHandle (finally_arg); }); 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, throw_sys_if (!ChangeServiceConfig (service, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE,
startOnBoot ? SERVICE_ERROR_SEVERE : SERVICE_ERROR_NORMAL, startOnBoot ? SERVICE_ERROR_SEVERE : SERVICE_ERROR_NORMAL,
driverPath.empty() ? NULL : driverPath.c_str(), NULL,
startOnBoot ? L"Filter" : NULL, startOnBoot ? L"Filter" : NULL,
NULL, NULL, NULL, NULL, NULL)); NULL, NULL, NULL, NULL, NULL));
@@ -1661,8 +1638,7 @@ namespace VeraCrypt
{ {
SystemDriveConfiguration config = GetSystemDriveConfiguration(); SystemDriveConfiguration config = GetSystemDriveConfiguration();
if (IsOSAtLeast (WIN_7) if (config.Partitions.size() == 2
&& config.Partitions.size() == 2
&& config.ExtraBootPartitionPresent && config.ExtraBootPartitionPresent
&& config.DrivePartition.Info.PartitionLength.QuadPart - config.SystemPartition.Info.PartitionLength.QuadPart < 164 * BYTES_PER_MB) && 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); *(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)) if (rescueDisk && (ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION))
buffer[TC_BOOT_SECTOR_CONFIG_OFFSET] |= TC_BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION; buffer[TC_BOOT_SECTOR_CONFIG_OFFSET] |= TC_BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION;
@@ -4745,9 +4720,6 @@ namespace VeraCrypt
break; break;
case DumpFilter: case DumpFilter:
if (!IsOSAtLeast (WIN_VISTA))
return;
filter = "veracrypt.sys"; filter = "veracrypt.sys";
filterReg = "DumpFilters"; filterReg = "DumpFilters";
SetLastError (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\CrashControl", 0, KEY_READ | KEY_WRITE, &regKey)); SetLastError (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\CrashControl", 0, KEY_READ | KEY_WRITE, &regKey));

View File

@@ -2243,7 +2243,7 @@ void InitDialog (HWND hwndDlg)
{ {
StringCbCopyW ((WCHAR *)metric.lfMessageFont.lfFaceName, sizeof (metric.lfMessageFont.lfFaceName), font->FaceName); 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. // 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. // 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 #else
// in TESTSIGNING mode, we support only Windows 7 and Windows 8/8.1 // in TESTSIGNING mode, we support only Windows 7 and Windows 8/8.1
if ( !IsOSVersionAtLeast(WIN_7, 0) if (
#ifndef SETUP #ifndef SETUP
|| IsOSVersionAtLeast(WIN_10, 0) IsOSVersionAtLeast(WIN_10, 0)
#else #else
|| (IsOSVersionAtLeast(WIN_10, 0) && !bMakePackage) || (IsOSVersionAtLeast(WIN_10, 0) && !bMakePackage)
#endif #endif
@@ -3637,14 +3637,11 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
#ifndef SETUP #ifndef SETUP
#ifdef _WIN64 #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 (!InitializeSecurityParameters(GetAppRandomSeed))
if (IsRamEncryptionEnabled()) AbortProcess("OUTOFMEMORY");
{
if (!InitializeSecurityParameters(GetAppRandomSeed))
AbortProcess("OUTOFMEMORY");
}
} }
#endif #endif
if (!EncryptionThreadPoolStart (ReadEncryptionThreadPoolFreeCpuCountLimit())) if (!EncryptionThreadPoolStart (ReadEncryptionThreadPoolFreeCpuCountLimit()))
@@ -3790,24 +3787,21 @@ BOOL GetSysDevicePaths (HWND hwndDlg)
StringCchCopyW (device.IsPartition ? SysPartitionDevicePath : SysDriveDevicePath, TC_MAX_PATH, device.Path.c_str()); 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 if (drive.ContainsSystem)
foreach (const HostDevice &drive, GetAvailableHostDevices (false, false))
{ {
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;
if (sysDrivePartition.Size <= TC_MAX_EXTRA_BOOT_PARTITION_SIZE) break;
ExtraBootPartitionDevicePath = sysDrivePartition.Path;
break;
}
} }
break;
} }
break;
} }
} }
@@ -7970,7 +7964,7 @@ void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap)
eventId = SHCNE_DRIVEADD; eventId = SHCNE_DRIVEADD;
else if (message == DBT_DEVICEREMOVECOMPLETE) else if (message == DBT_DEVICEREMOVECOMPLETE)
eventId = SHCNE_DRIVEREMOVED; 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; eventId = SHCNE_DRIVEREMOVED;
if (driveMap == 0) if (driveMap == 0)
@@ -8531,47 +8525,44 @@ retry:
mount.BytesPerPhysicalSector = bps; 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) wstring drivePath = L"\\\\.\\X:";
&& (root[1] == L':') HANDLE dev = INVALID_HANDLE_VALUE;
&& (towupper(root[0]) >= L'A' && towupper(root[0]) <= L'Z') 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)
{ {
wstring drivePath = L"\\\\.\\X:"; if (DeviceIoControl (dev, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, &extents, sizeof(extents), &dwResult, NULL))
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 (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; if (accessDesc.Size >= sizeof (STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR))
STORAGE_ADAPTER_DESCRIPTOR adapterDesc;
if (GetPhysicalDriveStorageInformation (extents.Extents[0].DiskNumber, &accessDesc, &adapterDesc))
{ {
if (accessDesc.Size >= sizeof (STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR)) mount.BytesPerSector = accessDesc.BytesPerLogicalSector;
{ mount.BytesPerPhysicalSector = accessDesc.BytesPerPhysicalSector;
mount.BytesPerSector = accessDesc.BytesPerLogicalSector; }
mount.BytesPerPhysicalSector = accessDesc.BytesPerPhysicalSector;
}
if (adapterDesc.Size >= sizeof (STORAGE_ADAPTER_DESCRIPTOR)) if (adapterDesc.Size >= sizeof (STORAGE_ADAPTER_DESCRIPTOR))
{ {
mount.MaximumTransferLength = adapterDesc.MaximumTransferLength; mount.MaximumTransferLength = adapterDesc.MaximumTransferLength;
mount.MaximumPhysicalPages = adapterDesc.MaximumPhysicalPages; mount.MaximumPhysicalPages = adapterDesc.MaximumPhysicalPages;
mount.AlignmentMask = adapterDesc.AlignmentMask; mount.AlignmentMask = adapterDesc.AlignmentMask;
}
} }
} }
} }
CloseHandle (dev);
} }
CloseHandle (dev);
} }
} }
@@ -8874,12 +8865,9 @@ retry:
goto retry; goto retry;
} }
if (IsOSAtLeast (WIN_7)) // Undo SHCNE_DRIVEREMOVED
{ wchar_t root[] = { (wchar_t) nDosDriveNo + L'A', L':', L'\\', 0 };
// Undo SHCNE_DRIVEREMOVED SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
wchar_t root[] = { (wchar_t) nDosDriveNo + L'A', L':', L'\\', 0 };
SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
}
return FALSE; return FALSE;
} }
@@ -9079,9 +9067,6 @@ BOOL IsUacSupported ()
HKEY hkey; HKEY hkey;
DWORD value = 1, size = sizeof (DWORD); 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 (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) 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])); GetModuleFileNameW (NULL, exeFilename, sizeof (exeFilename) / sizeof(exeFilename[0]));
strToMatch = wcsrchr (exeFilename, L'\\') + 1; 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; *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) if ((len = ReadRegistryBytes (regPath, key, (char *) strTmp, sizeof (strTmp))) > 0)
{ {
@@ -9769,47 +9754,25 @@ void CleanLastVisitedMRU (void)
DeleteRegistryValue (regPath, key); DeleteRegistryValue (regPath, key);
// Remove ID from MRUList // Remove ID from MRUList
if (IsOSAtLeast (WIN_VISTA)) 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)
{ {
int *p = (int *)buf; l -= sizeof (int);
int *pout = (int *)bufout;
int l;
l = len = ReadRegistryBytes (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU", L"MRUListEx", buf, sizeof (buf)); if (*p == id)
while (l > 0)
{ {
l -= sizeof (int); p++;
len -= sizeof (int);
if (*p == id) continue;
{
p++;
len -= sizeof (int);
continue;
}
*pout++ = *p++;
} }
*pout++ = *p++;
WriteRegistryBytes (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU", L"MRUListEx", bufout, len);
} }
else
{
wchar_t *p = (wchar_t*) buf;
wchar_t *pout = (wchar_t*) bufout;
ReadRegistryString (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedMRU", L"MRUList", L"", (wchar_t*) buf, sizeof (buf)); WriteRegistryBytes (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedPidlMRU", L"MRUListEx", bufout, len);
while (*p)
{
if (*p == id)
{
p++;
continue;
}
*pout++ = *p++;
}
*pout++ = 0;
WriteRegistryString (L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\LastVisitedMRU", L"MRUList", (wchar_t*) bufout);
}
break; break;
} }
@@ -9991,7 +9954,7 @@ void TaskBarIconDisplayBalloonTooltip (HWND hwnd, wchar_t *headline, wchar_t *te
tnid.uFlags = NIF_INFO; tnid.uFlags = NIF_INFO;
tnid.dwInfoFlags = (warning ? NIIF_WARNING : NIIF_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.szInfoTitle, sizeof(tnid.szInfoTitle), headline);
StringCbCopyW (tnid.szInfo, sizeof(tnid.szInfo),text); StringCbCopyW (tnid.szInfo, sizeof(tnid.szInfo),text);
@@ -11024,7 +10987,7 @@ void Applink (const char *dest)
CorrectURL (url); CorrectURL (url);
} }
if (IsOSAtLeast (WIN_VISTA) && IsAdmin ()) if (IsAdmin ())
{ {
int openDone = 0; int openDone = 0;
if (buildUrl) if (buildUrl)
@@ -11106,8 +11069,6 @@ void HandleDriveNotReadyError (HWND hwnd)
{ {
Warning ("SYS_AUTOMOUNT_DISABLED", hwnd); Warning ("SYS_AUTOMOUNT_DISABLED", hwnd);
} }
else if (nCurrentOS == WIN_VISTA && CurrentOSServicePack < 1)
Warning ("SYS_ASSIGN_DRIVE_LETTER", hwnd);
else else
Warning ("DEVICE_NOT_READY_ERROR", hwnd); Warning ("DEVICE_NOT_READY_ERROR", hwnd);
@@ -13016,11 +12977,6 @@ BOOL IsWindowsIsoBurnerAvailable ()
{ {
wchar_t path[MAX_PATH*2] = { 0 }; wchar_t path[MAX_PATH*2] = { 0 };
if (!IsOSAtLeast (WIN_7))
{
return FALSE;
}
if (SUCCEEDED(SHGetFolderPath (NULL, CSIDL_SYSTEM, NULL, 0, path))) if (SUCCEEDED(SHGetFolderPath (NULL, CSIDL_SYSTEM, NULL, 0, path)))
{ {
StringCbCatW (path, MAX_PATH*2, L"\\" ISO_BURNER_TOOL); StringCbCatW (path, MAX_PATH*2, L"\\" ISO_BURNER_TOOL);
@@ -13346,16 +13302,13 @@ void ProcessEntropyEstimate (HWND hProgress, DWORD* pdwInitialValue, DWORD dwCou
else else
*pdwEntropy = dwMaxLevel; *pdwEntropy = dwMaxLevel;
if (IsOSAtLeast (WIN_VISTA)) int state = PBST_ERROR;
{ if (*pdwEntropy >= (dwMaxLevel/2))
int state = PBST_ERROR; state = PBST_NORMAL;
if (*pdwEntropy >= (dwMaxLevel/2)) else if (*pdwEntropy >= (dwMaxLevel/4))
state = PBST_NORMAL; state = PBST_PAUSED;
else if (*pdwEntropy >= (dwMaxLevel/4))
state = PBST_PAUSED;
SendMessage (hProgress, PBM_SETSTATE, state, 0); SendMessage (hProgress, PBM_SETSTATE, state, 0);
}
SendMessage (hProgress, PBM_SETPOS, SendMessage (hProgress, PBM_SETPOS,
(WPARAM) (*pdwEntropy), (WPARAM) (*pdwEntropy),
@@ -14351,7 +14304,7 @@ HRESULT ShellExecInExplorerProcess(PCWSTR pszFile)
void SafeOpenURL (LPCWSTR szUrl) void SafeOpenURL (LPCWSTR szUrl)
{ {
BOOL bFallback = TRUE; BOOL bFallback = TRUE;
if (IsOSAtLeast (WIN_VISTA) && IsUacSupported() && IsAdmin () && IsElevated() && GetShellWindow()) if (IsUacSupported() && IsAdmin () && IsElevated() && GetShellWindow())
{ {
WCHAR szRunDllPath[TC_MAX_PATH]; WCHAR szRunDllPath[TC_MAX_PATH];
WCHAR szUrlDllPath[TC_MAX_PATH]; WCHAR szUrlDllPath[TC_MAX_PATH];

View File

@@ -218,7 +218,7 @@ begin_format:
bFailedRequiredDASD = TRUE; 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 // 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 // to which no drive letter has been assigned under the system. This problem can be worked

View File

@@ -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) if (AskWarnYesNoString ((wstring (GetString ("SYSDRIVE_NON_STANDARD_PARTITIONS")) + L"\n\n" + GetString ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE")).c_str(), MainDlg) == IDYES)
bWholeSysDrive = FALSE; 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() else if (BootEncObj->SystemPartitionCoversWholeDrive()
&& !bWholeSysDrive) && !bWholeSysDrive)
@@ -5102,7 +5084,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
} }
//exFAT support added starting from Vista SP1 //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); AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), L"exFAT", FILESYS_EXFAT);
bEXFATallowed = TRUE; 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) if (volumePassword.Length > 0)
{ {
// Check password length (check also done for outer volume which is not the case in TrueCrypt). // 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 else
StringCbCatW (szRescueDiskISO, sizeof(szRescueDiskISO), L"\\VeraCrypt Rescue Disk.iso"); 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.
// Availability of in-place encryption (which is pre-selected by default whenever bWarnDeviceFormatAdvanced = FALSE;
// possible) makes partition-hosted volume creation safer.
bWarnDeviceFormatAdvanced = FALSE;
}
#ifdef _DEBUG #ifdef _DEBUG
// For faster testing // 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) if (AskWarnYesNoString ((wstring (GetString ("SYSDRIVE_NON_STANDARD_PARTITIONS")) + L"\n\n" + GetString ("ASK_ENCRYPT_PARTITION_INSTEAD_OF_DRIVE")).c_str(), MainDlg) == IDYES)
bWholeSysDrive = FALSE; 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()) if (!bWholeSysDrive && BootEncObj->SystemPartitionCoversWholeDrive())
@@ -7310,8 +7267,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (bHiddenOS) if (bHiddenOS)
{ {
if (IsOSAtLeast (WIN_7) if (BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent
&& BootEncObj->GetSystemDriveConfiguration().ExtraBootPartitionPresent
&& AskWarnYesNo ("CONFIRM_HIDDEN_OS_EXTRA_BOOT_PARTITION", hwndDlg) == IDNO) && AskWarnYesNo ("CONFIRM_HIDDEN_OS_EXTRA_BOOT_PARTITION", hwndDlg) == IDNO)
{ {
TextInfoDialogBox (TC_TBXID_EXTRA_BOOT_PARTITION_REMOVAL_INSTRUCTIONS); 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 if (bHiddenVol && !bHiddenVolHost) // If it's a hidden volume
@@ -9289,7 +9238,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine)
CmdVolumeFilesystem = FILESYS_FAT; CmdVolumeFilesystem = FILESYS_FAT;
else if (_wcsicmp(szTmp, L"NTFS") == 0) else if (_wcsicmp(szTmp, L"NTFS") == 0)
CmdVolumeFilesystem = FILESYS_NTFS; CmdVolumeFilesystem = FILESYS_NTFS;
else if (IsOSVersionAtLeast (WIN_VISTA, 1) && _wcsicmp(szTmp, L"EXFAT") == 0) else if (_wcsicmp(szTmp, L"EXFAT") == 0)
CmdVolumeFilesystem = FILESYS_EXFAT; CmdVolumeFilesystem = FILESYS_EXFAT;
else if (IsOSVersionAtLeast (WIN_10, 0) && _wcsicmp(szTmp, L"ReFS") == 0) else if (IsOSVersionAtLeast (WIN_10, 0) && _wcsicmp(szTmp, L"ReFS") == 0)
CmdVolumeFilesystem = FILESYS_REFS; CmdVolumeFilesystem = FILESYS_REFS;
@@ -10650,10 +10599,6 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
InitApp (hInstance, lpszCommandLine); 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 #if TC_MAX_VOLUME_SECTOR_SIZE > 64 * 1024
#error TC_MAX_VOLUME_SECTOR_SIZE > 64 * 1024 #error TC_MAX_VOLUME_SECTOR_SIZE > 64 * 1024
#endif #endif

View File

@@ -5565,21 +5565,18 @@ retry:
goto 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 for (i = 0; i < 26; i++)
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++) 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)); memset (&SystemFavoritesServiceStatus, 0, sizeof (SystemFavoritesServiceStatus));
SystemFavoritesServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; SystemFavoritesServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
SystemFavoritesServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; 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++) 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); 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); 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)) if (IsOSAtLeast (WIN_8_1))
SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ALLOW_WINDOWS_DEFRAG, allowWindowsDefrag); SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ALLOW_WINDOWS_DEFRAG, allowWindowsDefrag);
SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ENABLE_CPU_RNG, enableCpuRng); 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)
{
if (enableRamEncryption)
{
// 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 (bHiberbootEnabled) BOOL originalRamEncryptionEnabled = (driverConfig & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION)? TRUE : FALSE;
{ if (originalRamEncryptionEnabled != enableRamEncryption)
BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power", L"HiberbootEnabled", 0); {
} if (enableRamEncryption)
{
// 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 (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; DWORD bytesReturned;
if (!DeviceIoControl (hDriver, TC_IOCTL_REREAD_DRIVER_CONFIG, NULL, 0, NULL, 0, &bytesReturned, NULL)) if (!DeviceIoControl (hDriver, TC_IOCTL_REREAD_DRIVER_CONFIG, NULL, 0, NULL, 0, &bytesReturned, NULL))

View File

@@ -570,25 +570,12 @@ BOOL IsSystemRestoreEnabled ()
GetRestorePointRegKeyName (szRegPath, sizeof (szRegPath)); GetRestorePointRegKeyName (szRegPath, sizeof (szRegPath));
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, szRegPath, 0, KEY_READ | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS) 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)
)
{ {
if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue)) bEnabled = TRUE;
&& (dwValue == 1)
)
{
bEnabled = TRUE;
}
} }
else
{
if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"DisableSR", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
&& (dwValue == 0)
)
{
bEnabled = TRUE;
}
}
RegCloseKey (hKey); RegCloseKey (hKey);
} }
@@ -1357,13 +1344,10 @@ error:
} }
// Register COM servers for UAC // 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; return bOK;
@@ -1436,16 +1420,9 @@ BOOL DoApplicationDataUninstall (HWND hwndDlg)
BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated) BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated)
{ {
wchar_t regk [64]; 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 // Unregister COM servers
if (!bRemoveDeprecated && IsOSAtLeast (WIN_VISTA)) if (!bRemoveDeprecated)
{ {
if (!UnregisterComServers (InstallationPath)) if (!UnregisterComServers (InstallationPath))
StatusMessage (hwndDlg, "COM_DEREG_FAILED"); StatusMessage (hwndDlg, "COM_DEREG_FAILED");
@@ -1454,16 +1431,9 @@ BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated)
if (!bRemoveDeprecated) if (!bRemoveDeprecated)
StatusMessage (hwndDlg, "REMOVING_REG"); StatusMessage (hwndDlg, "REMOVING_REG");
if (RegDeleteKeyExWPtr) 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);
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");
}
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Classes\\VeraCryptVolume\\Shell\\open\\command"); 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\\open");
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Classes\\VeraCryptVolume\\Shell"); 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); SHChangeNotify (SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
} }
if (hAdvapiDll)
FreeLibrary (hAdvapiDll);
return TRUE; return TRUE;
} }
@@ -2879,7 +2846,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
if (!bUninstall) if (!bUninstall)
{ {
if (!bDevm && !LocalizationActive && (nCurrentOS >= WIN_VISTA)) if (!bDevm && !LocalizationActive)
{ {
BOOL bHasPreferredLanguage = (strlen (GetPreferredLangId ()) > 0)? TRUE : FALSE; BOOL bHasPreferredLanguage = (strlen (GetPreferredLangId ()) > 0)? TRUE : FALSE;
if ((IDCANCEL == DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_INSTALL_LANGUAGE), NULL, (DLGPROC) SelectLanguageDialogProc, (LPARAM) 0 )) if ((IDCANCEL == DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_INSTALL_LANGUAGE), NULL, (DLGPROC) SelectLanguageDialogProc, (LPARAM) 0 ))

View File

@@ -254,25 +254,12 @@ BOOL IsSystemRestoreEnabled ()
GetRestorePointRegKeyName (szRegPath, sizeof (szRegPath)); GetRestorePointRegKeyName (szRegPath, sizeof (szRegPath));
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, szRegPath, 0, KEY_READ | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS) 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)
)
{ {
if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue)) bEnabled = TRUE;
&& (dwValue == 1)
)
{
bEnabled = TRUE;
}
} }
else
{
if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"DisableSR", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
&& (dwValue == 0)
)
{
bEnabled = TRUE;
}
}
RegCloseKey (hKey); RegCloseKey (hKey);
} }
@@ -882,8 +869,6 @@ void HandleDriveNotReadyError_Dll (MSIHANDLE hInstaller)
{ {
MSILogAndShow (hInstaller, MSI_WARNING_LEVEL, GetString("SYS_AUTOMOUNT_DISABLED")); 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 else
MSILogAndShow (hInstaller, MSI_WARNING_LEVEL, GetString("DEVICE_NOT_READY_ERROR")); MSILogAndShow (hInstaller, MSI_WARNING_LEVEL, GetString("DEVICE_NOT_READY_ERROR"));
@@ -1717,7 +1702,7 @@ BOOL DoRegUninstall_Dll (MSIHANDLE hInstaller, BOOL bRemoveDeprecated)
} }
// Unregister COM servers // Unregister COM servers
if (!bRemoveDeprecated && IsOSAtLeast (WIN_VISTA)) if (!bRemoveDeprecated)
{ {
if (!UnregisterComServers (InstallationPath)) if (!UnregisterComServers (InstallationPath))
MSILog (hInstaller, MSI_ERROR_LEVEL, GetString("COM_DEREG_FAILED")); 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() // Last part of DoRegInstall()
{ {
// Register COM servers for UAC // 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;
}
} }
} }