VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2018-04-16 23:48:54 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2018-04-23 16:59:33 +0200
commit4519bb494e7c88890aa0022d4aaabffb0b6d8faf (patch)
tree11e8d1fd8f8e300d851deddc697712e484e5506a
parentcce74aaee0a96b13b5793de4f2f2099ea1d29338 (diff)
downloadVeraCrypt-4519bb494e7c88890aa0022d4aaabffb0b6d8faf.tar.gz
VeraCrypt-4519bb494e7c88890aa0022d4aaabffb0b6d8faf.zip
Windows: implement compatibility for Windows 10 major updates using ReflectDrivers mechanism whose support started from Windows 10 version 1607.
-rw-r--r--src/Common/BaseCom.cpp24
-rw-r--r--src/Common/BaseCom.h1
-rw-r--r--src/Common/BootEncryption.cpp59
-rw-r--r--src/Common/BootEncryption.h2
-rw-r--r--src/Common/Dlgcode.c125
-rw-r--r--src/Common/Dlgcode.h3
-rw-r--r--src/Format/FormatCom.cpp5
-rw-r--r--src/Format/FormatCom.idl3
-rw-r--r--src/Mount/MainCom.cpp5
-rw-r--r--src/Mount/MainCom.idl3
-rw-r--r--src/Release/Setup Files/veracrypt-x64.catbin0 -> 10590 bytes
-rw-r--r--src/Release/Setup Files/veracrypt-x64.sysbin828688 -> 828688 bytes
-rw-r--r--src/Release/Setup Files/veracrypt.Inf80
-rw-r--r--src/Release/Setup Files/veracrypt.catbin0 -> 10558 bytes
-rw-r--r--src/Release/Setup Files/veracrypt.sysbin768528 -> 768528 bytes
-rw-r--r--src/Setup/ComSetup.cpp12
-rw-r--r--src/Setup/Setup.c76
-rw-r--r--src/Setup/Setup.h5
18 files changed, 326 insertions, 77 deletions
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp
index e8c75a68..738e44cf 100644
--- a/src/Common/BaseCom.cpp
+++ b/src/Common/BaseCom.cpp
@@ -430,4 +430,28 @@ DWORD BaseCom::WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMe
}
return ERROR_SUCCESS;
+}
+
+DWORD BaseCom::UpdateSetupConfigFile (BOOL bForInstall)
+{
+ try
+ {
+ BootEncryption bootEnc (NULL);
+ bootEnc.UpdateSetupConfigFile (bForInstall? true : false);
+ }
+ catch (SystemException &)
+ {
+ return GetLastError();
+ }
+ catch (Exception &e)
+ {
+ e.Show (NULL);
+ return ERROR_EXCEPTION_IN_SERVICE;
+ }
+ catch (...)
+ {
+ return ERROR_EXCEPTION_IN_SERVICE;
+ }
+
+ return ERROR_SUCCESS;
} \ No newline at end of file
diff --git a/src/Common/BaseCom.h b/src/Common/BaseCom.h
index e91f75af..eb89dd8e 100644
--- a/src/Common/BaseCom.h
+++ b/src/Common/BaseCom.h
@@ -117,6 +117,7 @@ public:
static DWORD RestoreEfiSystemLoader ();
static DWORD GetEfiBootDeviceNumber (BSTR* pSdn);
static DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
+ static DWORD UpdateSetupConfigFile (BOOL bForInstall);
};
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index 55eafb75..b57f5c28 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -396,6 +396,18 @@ namespace VeraCrypt
}
}
+ static void UpdateSetupConfigFile (bool bForInstall)
+ {
+ Elevate();
+
+ DWORD result = ElevatedComInstance->UpdateSetupConfigFile (bForInstall ? TRUE : FALSE);
+ if (result != ERROR_SUCCESS)
+ {
+ SetLastError (result);
+ throw SystemException(SRC_POS);
+ }
+ }
+
static void Release ()
{
if (--ReferenceCount == 0 && ElevatedComInstance)
@@ -470,6 +482,7 @@ namespace VeraCrypt
static void RestoreEfiSystemLoader () { throw ParameterIncorrect (SRC_POS); }
static void GetEfiBootDeviceNumber (PSTORAGE_DEVICE_NUMBER pSdn) { throw ParameterIncorrect (SRC_POS); }
static void WriteEfiBootSectorUserConfig (byte userConfig, const string &customUserMessage, int pim, int hashAlg) { throw ParameterIncorrect (SRC_POS); }
+ static void UpdateSetupConfigFile (bool bForInstall) { throw ParameterIncorrect (SRC_POS); }
};
#endif // SETUP
@@ -2685,6 +2698,27 @@ namespace VeraCrypt
return conf.Save (path.c_str(), hwndDlg);
}
+ void BootEncryption::UpdateSetupConfigFile (bool bForInstall)
+ {
+ // starting from Windows 10 1607 (Build 14393), ReflectDrivers in Setupconfig.ini is supported
+ if (IsOSVersionAtLeast (WIN_10, 0) && CurrentOSBuildNumber >= 14393)
+ {
+ wchar_t szInstallPath [TC_MAX_PATH];
+ wchar_t szSetupconfigLocation [TC_MAX_PATH + 20];
+
+ if (bForInstall)
+ GetInstallationPath (NULL, szInstallPath, ARRAYSIZE (szInstallPath), NULL);
+ if (GetSetupconfigLocation (szSetupconfigLocation, ARRAYSIZE (szSetupconfigLocation)))
+ {
+ ::CreateDirectoryW (szSetupconfigLocation, NULL);
+
+ StringCchCatW (szSetupconfigLocation, ARRAYSIZE (szSetupconfigLocation), L"SetupConfig.ini");
+
+ WritePrivateProfileStringW (L"SetupConfig", L"ReflectDrivers", bForInstall? szInstallPath : NULL, szSetupconfigLocation);
+ }
+ }
+ }
+
void BootEncryption::InstallBootLoader (bool preserveUserConfig, bool hiddenOSCreation, int pim, int hashAlg)
{
Device device (GetSystemDriveConfiguration().DevicePath);
@@ -2851,6 +2885,15 @@ namespace VeraCrypt
device.SeekAt (TC_SECTOR_SIZE_BIOS);
device.Write (bootLoaderBuf + TC_SECTOR_SIZE_BIOS, sizeof (bootLoaderBuf) - TC_SECTOR_SIZE_BIOS);
}
+
+ if (!IsAdmin() && IsUacSupported())
+ {
+ Elevator::UpdateSetupConfigFile (true);
+ }
+ else
+ {
+ UpdateSetupConfigFile (true);
+ }
}
#ifndef SETUP
@@ -3786,6 +3829,22 @@ namespace VeraCrypt
device.SeekAt (0);
device.Write (bootLoaderBuf, sizeof (bootLoaderBuf));
}
+
+ // starting from Windows 10 1607 (Build 14393), ReflectDrivers in Setupconfig.ini is supported
+ if (IsOSVersionAtLeast (WIN_10, 0) && CurrentOSBuildNumber >= 14393)
+ {
+ wchar_t szSetupconfigLocation [TC_MAX_PATH + 20];
+
+ if (GetSetupconfigLocation (szSetupconfigLocation, ARRAYSIZE (szSetupconfigLocation)))
+ {
+ StringCchCatW (szSetupconfigLocation, ARRAYSIZE (szSetupconfigLocation), L"SetupConfig.ini");
+
+ if (FileExists (szSetupconfigLocation))
+ {
+ WritePrivateProfileStringW (L"SetupConfig", L"ReflectDrivers", NULL, szSetupconfigLocation);
+ }
+ }
+ }
}
#endif // SETUP
diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h
index f63ec541..6eb42b50 100644
--- a/src/Common/BootEncryption.h
+++ b/src/Common/BootEncryption.h
@@ -310,7 +310,7 @@ namespace VeraCrypt
void GetEfiBootDeviceNumber (PSTORAGE_DEVICE_NUMBER pSdn);
void BackupSystemLoader ();
void RestoreSystemLoader ();
-
+ void UpdateSetupConfigFile (bool bForInstall);
protected:
static const uint32 RescueIsoImageSize = 1835008; // Size of ISO9660 image with bootable emulated 1.44MB floppy disk image
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 347f1207..03e0d6c8 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -147,6 +147,7 @@ OSVersionEnum nCurrentOS = WIN_UNKNOWN;
int CurrentOSMajor = 0;
int CurrentOSMinor = 0;
int CurrentOSServicePack = 0;
+int CurrentOSBuildNumber = 0;
BOOL RemoteSession = FALSE;
BOOL UacElevated = FALSE;
@@ -344,6 +345,13 @@ static unsigned char gpbSha1CodeSignCertFingerprint[64] = {
0x40, 0xCE, 0x17, 0x6C
};
+typedef HRESULT (WINAPI *SHGETKNOWNFOLDERPATH) (
+ _In_ REFKNOWNFOLDERID rfid,
+ _In_ DWORD dwFlags,
+ _In_opt_ HANDLE hToken,
+ _Out_ PWSTR *ppszPath
+);
+
/* Windows dialog class */
#define WINDOWS_DIALOG_CLASS L"#32770"
@@ -2663,6 +2671,7 @@ void InitOSVersionInfo ()
CurrentOSMajor = os.dwMajorVersion;
CurrentOSMinor = os.dwMinorVersion;
CurrentOSServicePack = os.wServicePackMajor;
+ CurrentOSBuildNumber = os.dwBuildNumber;
if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && CurrentOSMajor == 5 && CurrentOSMinor == 0)
nCurrentOS = WIN_2000;
@@ -13520,3 +13529,119 @@ BOOL VerifyModuleSignature (const wchar_t* path)
return bResult;
}
+
+void GetInstallationPath (HWND hwndDlg, wchar_t* szInstallPath, DWORD cchSize, BOOL* pbInstallPathDetermined)
+{
+ HKEY hkey;
+ BOOL bInstallPathDetermined = FALSE;
+ wchar_t path[MAX_PATH+20];
+ ITEMIDLIST *itemList;
+
+ memset (szInstallPath, 0, cchSize * sizeof (wchar_t));
+
+ // Determine if VeraCrypt is already installed and try to determine its "Program Files" location
+ if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", 0, KEY_READ | KEY_WOW64_32KEY, &hkey) == ERROR_SUCCESS)
+ {
+ /* Default 'UninstallString' registry strings written by VeraCrypt:
+ ------------------------------------------------------------------------------------
+ 5.0+ "C:\Program Files\VeraCrypt\VeraCrypt Setup.exe" /u
+ */
+
+ wchar_t rv[MAX_PATH*4];
+ DWORD size = sizeof (rv);
+ if (RegQueryValueEx (hkey, L"UninstallString", 0, 0, (LPBYTE) &rv, &size) == ERROR_SUCCESS && wcsrchr (rv, L'/'))
+ {
+ size_t len = 0;
+
+ // Cut and paste the location (path) where VeraCrypt is installed to InstallationPath
+ if (rv[0] == L'"')
+ {
+ len = wcsrchr (rv, L'/') - rv - 2;
+ StringCchCopyNW (szInstallPath, cchSize, rv + 1, len);
+ szInstallPath [len] = 0;
+ bInstallPathDetermined = TRUE;
+
+ if (szInstallPath [wcslen (szInstallPath) - 1] != L'\\')
+ {
+ len = wcsrchr (szInstallPath, L'\\') - szInstallPath;
+ szInstallPath [len] = 0;
+ }
+ }
+
+ }
+ RegCloseKey (hkey);
+ }
+
+ if (!bInstallPathDetermined)
+ {
+ /* VeraCrypt is not installed or it wasn't possible to determine where it is installed. */
+
+ // Default "Program Files" path.
+ SHGetSpecialFolderLocation (hwndDlg, CSIDL_PROGRAM_FILES, &itemList);
+ SHGetPathFromIDList (itemList, path);
+
+ if (Is64BitOs())
+ {
+ // Use a unified default installation path (registry redirection of %ProgramFiles% does not work if the installation path is user-selectable)
+ wstring s = path;
+ size_t p = s.find (L" (x86)");
+ if (p != wstring::npos)
+ {
+ s = s.substr (0, p);
+ if (_waccess (s.c_str(), 0) != -1)
+ StringCbCopyW (path, sizeof (path), s.c_str());
+ }
+ }
+
+ StringCbCatW (path, sizeof(path), L"\\VeraCrypt\\");
+ StringCbCopyW (szInstallPath, cchSize, path);
+ }
+
+ // Make sure the path ends with a backslash
+ if (szInstallPath [wcslen (szInstallPath) - 1] != L'\\')
+ {
+ StringCbCatW (szInstallPath, cchSize, L"\\");
+ }
+
+ if (pbInstallPathDetermined)
+ *pbInstallPathDetermined = bInstallPathDetermined;
+}
+
+BOOL GetSetupconfigLocation (wchar_t* path, DWORD cchSize)
+{
+ wchar_t szShell32Path[MAX_PATH] = {0};
+ HMODULE hShell32 = NULL;
+ BOOL bResult = FALSE;
+
+ path[0] = 0;
+
+ if (GetSystemDirectory(szShell32Path, MAX_PATH))
+ StringCchCatW (szShell32Path, MAX_PATH, L"\\Shell32.dll");
+ else
+ StringCchCopyW (szShell32Path, MAX_PATH, L"C:\\Windows\\System32\\Shell32.dll");
+
+ hShell32 = LoadLibrary (szShell32Path);
+ if (hShell32)
+ {
+ SHGETKNOWNFOLDERPATH SHGetKnownFolderPathFn = (SHGETKNOWNFOLDERPATH) GetProcAddress (hShell32, "SHGetKnownFolderPath");
+ if (SHGetKnownFolderPathFn)
+ {
+ wchar_t* pszUsersPath = NULL;
+ if (S_OK == SHGetKnownFolderPathFn (FOLDERID_UserProfiles, 0, NULL, &pszUsersPath))
+ {
+ StringCchPrintfW (path, cchSize, L"%s\\Default\\AppData\\Local\\Microsoft\\Windows\\WSUS\\", pszUsersPath);
+ CoTaskMemFree (pszUsersPath);
+ bResult = TRUE;
+ }
+ }
+ FreeLibrary (hShell32);
+ }
+
+ if (!bResult && CurrentOSMajor >= 10)
+ {
+ StringCchPrintfW (path, cchSize, L"%c:\\Users\\Default\\AppData\\Local\\Microsoft\\Windows\\WSUS\\", szShell32Path[0]);
+ bResult = TRUE;
+ }
+
+ return bResult;
+}
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 5d10db35..ea2828fd 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -135,6 +135,7 @@ extern OSVersionEnum nCurrentOS;
extern int CurrentOSMajor;
extern int CurrentOSMinor;
extern int CurrentOSServicePack;
+extern int CurrentOSBuildNumber;
extern BOOL RemoteSession;
extern HANDLE hDriver;
extern HINSTANCE hInst;
@@ -529,6 +530,8 @@ BOOL RaisePrivileges(void);
BOOL DeleteDirectory (const wchar_t* szDirName);
INT_PTR SecureDesktopDialogBoxParam (HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM);
BOOL VerifyModuleSignature (const wchar_t* path);
+void GetInstallationPath (HWND hwndDlg, wchar_t* szInstallPath, DWORD cchSize, BOOL* pbInstallPathDetermined);
+BOOL GetSetupconfigLocation (wchar_t* path, DWORD cchSize);
#ifdef __cplusplus
}
diff --git a/src/Format/FormatCom.cpp b/src/Format/FormatCom.cpp
index 1bfb4be9..5df23f19 100644
--- a/src/Format/FormatCom.cpp
+++ b/src/Format/FormatCom.cpp
@@ -172,6 +172,11 @@ public:
return BaseCom::WriteEfiBootSectorUserConfig (userConfig, customUserMessage,pim, hashAlg);
}
+ virtual DWORD STDMETHODCALLTYPE UpdateSetupConfigFile (BOOL bForInstall)
+ {
+ return BaseCom::UpdateSetupConfigFile (bForInstall);
+ }
+
protected:
DWORD MessageThreadId;
LONG RefCount;
diff --git a/src/Format/FormatCom.idl b/src/Format/FormatCom.idl
index 855d024b..970fe568 100644
--- a/src/Format/FormatCom.idl
+++ b/src/Format/FormatCom.idl
@@ -16,7 +16,7 @@ import "..\Common\Password.h";
[
uuid(56327DDA-F1A7-4e13-B128-520D129BDEF6),
helpstring("VeraCrypt Format UAC Support Library"),
- version(2.7) // Update ComSetup.cpp when changing version number
+ version(2.8) // Update ComSetup.cpp when changing version number
]
library TrueCryptFormatCom
{
@@ -47,6 +47,7 @@ library TrueCryptFormatCom
DWORD RestoreEfiSystemLoader ();
DWORD GetEfiBootDeviceNumber (BSTR* pSdn);
DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
+ DWORD UpdateSetupConfigFile (BOOL bForInstall);
};
[
diff --git a/src/Mount/MainCom.cpp b/src/Mount/MainCom.cpp
index eb1f5921..f3ce90b2 100644
--- a/src/Mount/MainCom.cpp
+++ b/src/Mount/MainCom.cpp
@@ -193,6 +193,11 @@ public:
return BaseCom::WriteEfiBootSectorUserConfig (userConfig, customUserMessage,pim, hashAlg);
}
+ virtual DWORD STDMETHODCALLTYPE UpdateSetupConfigFile (BOOL bForInstall)
+ {
+ return BaseCom::UpdateSetupConfigFile (bForInstall);
+ }
+
protected:
DWORD MessageThreadId;
LONG RefCount;
diff --git a/src/Mount/MainCom.idl b/src/Mount/MainCom.idl
index a1ab3cd7..25bb80ce 100644
--- a/src/Mount/MainCom.idl
+++ b/src/Mount/MainCom.idl
@@ -16,7 +16,7 @@ import "..\Common\Password.h";
[
uuid(9ACF6176-5FC4-4690-A025-B3306A50EB6A),
helpstring("VeraCrypt Main UAC Support Library"),
- version(2.9) // Update ComSetup.cpp when changing version number
+ version(2.10) // Update ComSetup.cpp when changing version number
]
library TrueCryptMainCom
{
@@ -51,6 +51,7 @@ library TrueCryptMainCom
DWORD RestoreEfiSystemLoader ();
DWORD GetEfiBootDeviceNumber (BSTR* pSdn);
DWORD WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg);
+ DWORD UpdateSetupConfigFile (BOOL bForInstall);
};
[
diff --git a/src/Release/Setup Files/veracrypt-x64.cat b/src/Release/Setup Files/veracrypt-x64.cat
new file mode 100644
index 00000000..37a162c2
--- /dev/null
+++ b/src/Release/Setup Files/veracrypt-x64.cat
Binary files differ
diff --git a/src/Release/Setup Files/veracrypt-x64.sys b/src/Release/Setup Files/veracrypt-x64.sys
index 6c5227e7..f998a592 100644
--- a/src/Release/Setup Files/veracrypt-x64.sys
+++ b/src/Release/Setup Files/veracrypt-x64.sys
Binary files differ
diff --git a/src/Release/Setup Files/veracrypt.Inf b/src/Release/Setup Files/veracrypt.Inf
new file mode 100644
index 00000000..57f7f0af
--- /dev/null
+++ b/src/Release/Setup Files/veracrypt.Inf
@@ -0,0 +1,80 @@
+;;;
+;;; VeraCrypt
+;;;
+;;;
+;;; Copyright (c) 2018, IDRIX
+;;;
+
+[Version]
+signature = "$Windows NT$"
+Class = "Encryption" ;This is determined by the work this filter driver does
+ClassGuid = {a0a701c0-a511-42ff-aa6c-06dc0395576f} ;This value is determined by the Class
+Provider = %ProviderString%
+DriverVer = 04/14/2018,1.23.0.0
+CatalogFile = veracrypt.cat
+
+
+[DestinationDirs]
+DefaultDestDir = 12
+MiniFilter.DriverFiles = 12 ;%windir%\system32\drivers
+
+;;
+;; Default install sections
+;;
+
+[DefaultInstall]
+OptionDesc = %ServiceDescription%
+CopyFiles = MiniFilter.DriverFiles
+
+[DefaultInstall.Services]
+AddService = %ServiceName%,,MiniFilter.Service
+
+;;
+;; Default uninstall sections
+;;
+
+[DefaultUninstall]
+DelFiles = MiniFilter.DriverFiles
+
+[DefaultUninstall.Services]
+DelService = veracrypt,0x200 ;Ensure service is stopped before deleting
+
+;
+; Services Section
+;
+
+[MiniFilter.Service]
+DisplayName = %ServiceName%
+Description = %ServiceDescription%
+ServiceBinary = %12%\%DriverName%.sys ;%windir%\system32\drivers\
+Dependencies = "FltMgr"
+ServiceType = 2 ;SERVICE_FILE_SYSTEM_DRIVER
+;StartType = 0 ;SERVICE_BOOT_START
+StartType = 3 ;SERVICE_DEMAND_START
+ErrorControl = 1 ;SERVICE_ERROR_NORMAL
+LoadOrderGroup = "FSFilter Encryption"
+
+;
+; Copy Files
+;
+
+[MiniFilter.DriverFiles]
+%DriverName%.sys
+
+[SourceDisksFiles]
+veracrypt.sys = 1,,
+
+[SourceDisksNames]
+1 = %DiskId1%,,,
+
+;;
+;; String Section
+;;
+
+[Strings]
+ProviderString = "IDRIX"
+ServiceDescription = "veracrypt"
+ServiceName = "veracrypt"
+DriverName = "veracrypt"
+DiskId1 = "VeraCrypt Device Installation Disk"
+
diff --git a/src/Release/Setup Files/veracrypt.cat b/src/Release/Setup Files/veracrypt.cat
new file mode 100644
index 00000000..a7702aa9
--- /dev/null
+++ b/src/Release/Setup Files/veracrypt.cat
Binary files differ
diff --git a/src/Release/Setup Files/veracrypt.sys b/src/Release/Setup Files/veracrypt.sys
index 832ca495..bf33021a 100644
--- a/src/Release/Setup Files/veracrypt.sys
+++ b/src/Release/Setup Files/veracrypt.sys
Binary files differ
diff --git a/src/Setup/ComSetup.cpp b/src/Setup/ComSetup.cpp
index 8d59a3f7..64078076 100644
--- a/src/Setup/ComSetup.cpp
+++ b/src/Setup/ComSetup.cpp
@@ -11,10 +11,10 @@
*/
#define TC_MAIN_COM_VERSION_MAJOR 2
-#define TC_MAIN_COM_VERSION_MINOR 9
+#define TC_MAIN_COM_VERSION_MINOR 10
#define TC_FORMAT_COM_VERSION_MAJOR 2
-#define TC_FORMAT_COM_VERSION_MINOR 7
+#define TC_FORMAT_COM_VERSION_MINOR 8
#include <atlbase.h>
#include <comdef.h>
@@ -39,9 +39,9 @@ extern "C" BOOL RegisterComServers (wchar_t *modulePath)
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR, 0, SYS_WIN32);
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR, 0, SYS_WIN32);
// unregister older versions that may still exist
- for (WORD i = 5; i >= 1; i--)
+ for (WORD i = 6; i >= 1; i--)
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-i, 0, SYS_WIN32);
- for (WORD i = 3; i >= 1; i--)
+ for (WORD i = 4; i >= 1; i--)
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-i, 0, SYS_WIN32);
wchar_t setupModule[MAX_PATH];
@@ -78,9 +78,9 @@ extern "C" BOOL UnregisterComServers (wchar_t *modulePath)
return FALSE;
// unregister older versions that may still exist
- for (WORD i = 5; i >= 1; i--)
+ for (WORD i = 6; i >= 1; i--)
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-i, 0, SYS_WIN32);
- for (WORD i = 3; i >= 1; i--)
+ for (WORD i = 4; i >= 1; i--)
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-i, 0, SYS_WIN32);
wchar_t module[1024];
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index f6ea93fe..46583c46 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -748,6 +748,12 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
}
if (Is64BitOs ()
+ && wcscmp (szFiles[i], L"Averacrypt.cat") == 0)
+ {
+ StringCbCopyNW (curFileName, sizeof(curFileName), L"veracrypt-x64.cat", sizeof (L"veracrypt-x64.cat"));
+ }
+
+ if (Is64BitOs ()
&& wcscmp (szFiles[i], L"AVeraCrypt.exe") == 0)
{
StringCbCopyNW (curFileName, sizeof(curFileName), L"VeraCrypt-x64.exe", sizeof (L"VeraCrypt-x64.exe"));
@@ -2289,45 +2295,9 @@ void DoInstall (void *arg)
void SetInstallationPath (HWND hwndDlg)
{
- HKEY hkey;
BOOL bInstallPathDetermined = FALSE;
- wchar_t path[MAX_PATH+20];
- ITEMIDLIST *itemList;
-
- memset (InstallationPath, 0, sizeof (InstallationPath));
-
- // Determine if VeraCrypt is already installed and try to determine its "Program Files" location
- if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", 0, KEY_READ | KEY_WOW64_32KEY, &hkey) == ERROR_SUCCESS)
- {
- /* Default 'UninstallString' registry strings written by VeraCrypt:
- ------------------------------------------------------------------------------------
- 5.0+ "C:\Program Files\VeraCrypt\VeraCrypt Setup.exe" /u
- */
-
- wchar_t rv[MAX_PATH*4];
- DWORD size = sizeof (rv);
- if (RegQueryValueEx (hkey, L"UninstallString", 0, 0, (LPBYTE) &rv, &size) == ERROR_SUCCESS && wcsrchr (rv, L'/'))
- {
- size_t len = 0;
-
- // Cut and paste the location (path) where VeraCrypt is installed to InstallationPath
- if (rv[0] == L'"')
- {
- len = wcsrchr (rv, L'/') - rv - 2;
- StringCchCopyNW (InstallationPath, ARRAYSIZE(InstallationPath), rv + 1, len);
- InstallationPath [len] = 0;
- bInstallPathDetermined = TRUE;
-
- if (InstallationPath [wcslen (InstallationPath) - 1] != L'\\')
- {
- len = wcsrchr (InstallationPath, L'\\') - InstallationPath;
- InstallationPath [len] = 0;
- }
- }
-
- }
- RegCloseKey (hkey);
- }
+
+ GetInstallationPath (hwndDlg, InstallationPath, ARRAYSIZE (InstallationPath), &bInstallPathDetermined);
if (bInstallPathDetermined)
{
@@ -2343,36 +2313,6 @@ void SetInstallationPath (HWND hwndDlg)
bChangeMode = TRUE;
}
}
- else
- {
- /* VeraCrypt is not installed or it wasn't possible to determine where it is installed. */
-
- // Default "Program Files" path.
- SHGetSpecialFolderLocation (hwndDlg, CSIDL_PROGRAM_FILES, &itemList);
- SHGetPathFromIDList (itemList, path);
-
- if (Is64BitOs())
- {
- // Use a unified default installation path (registry redirection of %ProgramFiles% does not work if the installation path is user-selectable)
- wstring s = path;
- size_t p = s.find (L" (x86)");
- if (p != wstring::npos)
- {
- s = s.substr (0, p);
- if (_waccess (s.c_str(), 0) != -1)
- StringCbCopyW (path, sizeof (path), s.c_str());
- }
- }
-
- StringCbCatW (path, sizeof(path), L"\\VeraCrypt\\");
- StringCbCopyW (InstallationPath, sizeof(InstallationPath), path);
- }
-
- // Make sure the path ends with a backslash
- if (InstallationPath [wcslen (InstallationPath) - 1] != L'\\')
- {
- StringCbCatW (InstallationPath, sizeof(InstallationPath), L"\\");
- }
}
diff --git a/src/Setup/Setup.h b/src/Setup/Setup.h
index 12b4159f..ada20fb9 100644
--- a/src/Setup/Setup.h
+++ b/src/Setup/Setup.h
@@ -27,6 +27,8 @@ static wchar_t *szFiles[]=
L"AVeraCrypt.exe",
L"AVeraCryptExpander.exe",
L"AVeraCrypt Format.exe",
+ L"Averacrypt.inf",
+ L"Averacrypt.cat",
L"Averacrypt.sys",
L"Dveracrypt.sys",
L"AVeraCrypt Setup.exe",
@@ -46,7 +48,10 @@ static wchar_t *szCompressedFiles[]=
L"VeraCrypt-x64.exe",
L"VeraCryptExpander-x64.exe",
L"VeraCrypt Format-x64.exe",
+ L"veracrypt.inf",
+ L"veracrypt.cat",
L"veracrypt.sys",
+ L"veracrypt-x64.cat",
L"veracrypt-x64.sys",
L"Languages.zip",
L"docs.zip"