VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2021-09-05 01:11:04 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2021-09-05 01:13:23 +0200
commitddf9811b21ade89be55c9c357a5740ee3a41e9a9 (patch)
tree4d96b5f16c89208e704e45d01d652e75b751ace0 /src
parent8533ced1a4e6eb0b23ce6f05ca01d079f87b5efd (diff)
downloadVeraCrypt-ddf9811b21ade89be55c9c357a5740ee3a41e9a9.tar.gz
VeraCrypt-ddf9811b21ade89be55c9c357a5740ee3a41e9a9.zip
Windows: Block installation with exe installer if VeraCrypt was already installed using MSI package
Diffstat (limited to 'src')
-rw-r--r--src/Common/Language.xml1
-rw-r--r--src/Setup/Setup.c26
2 files changed, 27 insertions, 0 deletions
diff --git a/src/Common/Language.xml b/src/Common/Language.xml
index 6ca142d8..e2a0fc46 100644
--- a/src/Common/Language.xml
+++ b/src/Common/Language.xml
@@ -1565,6 +1565,7 @@
<entry lang="en" key="UNKNOWN_OPTION">Unknown option</entry>
<entry lang="en" key="VOLUME_LOCATION">Volume Location</entry>
<entry lang="en" key="VOLUME_HOST_IN_USE">WARNING: The host file/device {0} is already in use!\n\nIgnoring this can cause undesired results including system instability. All applications that might be using the host file/device should be closed before mounting the volume.\n\nContinue mounting?</entry>
+ <entry lang="en" key="CANT_INSTALL_WITH_EXE_OVER_MSI">VeraCrypt was previously installed using an MSI package and so it can't be updated using the standard installer.\n\nPlease use the MSI package to update your VeraCrypt installation.</entry>
</localization>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="VeraCrypt">
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index 382617ab..cbe1e85e 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -738,6 +738,24 @@ void DetermineUpgradeDowngradeStatus (BOOL bCloseDriverHandle, LONG *driverVersi
*driverVersionPtr = driverVersion;
}
+BOOL isMsiInstalled ()
+{
+ BOOL bRet = FALSE;
+ HKEY hKey;
+ if (ERROR_SUCCESS == RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\VeraCrypt_MSI", 0, KEY_READ | KEY_WOW64_64KEY, &hKey))
+ {
+ DWORD dwType = 0;
+ if ( (ERROR_SUCCESS == RegQueryValueExW(hKey, L"ProductGuid", NULL, &dwType, NULL, NULL))
+ && (REG_SZ == dwType))
+ {
+ bRet = TRUE;
+ }
+ RegCloseKey(hKey);
+ }
+
+ return bRet;
+}
+
static BOOL IsFileInUse (const wstring &filePath)
{
@@ -2224,6 +2242,14 @@ void DoInstall (void *arg)
ClearLogWindow (hwndDlg);
+ if (isMsiInstalled())
+ {
+ MessageBoxW (hwndDlg, GetString ("CANT_INSTALL_WITH_EXE_OVER_MSI"), lpszTitle, MB_ICONHAND);
+ Error ("INSTALL_FAILED", hwndDlg);
+ PostMessage (MainDlg, TC_APPMSG_INSTALL_FAILURE, 0, 0);
+ return;
+ }
+
if (mkfulldir (InstallationPath, TRUE) != 0)
{
if (mkfulldir (InstallationPath, FALSE) != 0)