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

Windows: Block installation with exe installer if VeraCrypt was already installed using MSI package

This commit is contained in:
Mounir IDRASSI
2021-09-05 01:11:04 +02:00
parent 8533ced1a4
commit ddf9811b21
42 changed files with 67 additions and 0 deletions

View File

@@ -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)