VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2024-08-12 23:15:37 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2024-08-12 23:15:37 +0200
commit83e1f08a8de49978ee454e7766568d6864a02460 (patch)
tree84b377b52e4f88ab01fe085ffcfd2f0680e54505 /src/Common
parent3d655ca2a3cd88eb15a021678bfa2bc474e8bfec (diff)
downloadVeraCrypt-83e1f08a8de49978ee454e7766568d6864a02460.tar.gz
VeraCrypt-83e1f08a8de49978ee454e7766568d6864a02460.zip
Windows: Add VCPassChanger tool that allow converting TrueCrypt volumes even when newer versions of VeraCrypt are installed
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Dlgcode.c42
-rw-r--r--src/Common/Dlgcode.h2
-rw-r--r--src/Common/Language.c9
-rw-r--r--src/Common/Tcdefs.h8
4 files changed, 35 insertions, 26 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index f26ae38c..afc3d874 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -28,7 +28,7 @@
#include <time.h>
#include <tchar.h>
#include <Richedit.h>
-#if defined (TCMOUNT) || defined (VOLFORMAT)
+#if defined (TCMOUNT) || defined (VOLFORMAT) || defined(VCPASSCHANGER)
#include <process.h>
#include <Tlhelp32.h>
#endif
@@ -1514,6 +1514,7 @@ void cleanup ()
/* Close the device driver handle */
if (hDriver != INVALID_HANDLE_VALUE)
{
+#ifndef VCPASSCHANGER
// Unload driver mode if possible (non-install mode)
if (IsNonInstallMode ())
{
@@ -1534,6 +1535,7 @@ void cleanup ()
}
}
else
+#endif
{
CloseHandle (hDriver);
hDriver = INVALID_HANDLE_VALUE;
@@ -2328,20 +2330,20 @@ BOOL CALLBACK AboutDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
L"Based on TrueCrypt 7.1a, freely available at http://www.truecrypt.org/ .\r\n\r\n"
L"Portions of this software:\r\n"
- L"Copyright \xA9 2013-2022 IDRIX. All rights reserved.\r\n"
+ L"Copyright \xA9 2013-2024 IDRIX. All rights reserved.\r\n"
L"Copyright \xA9 2003-2012 TrueCrypt Developers Association. All Rights Reserved.\r\n"
L"Copyright \xA9 1998-2000 Paul Le Roux. All Rights Reserved.\r\n"
L"Copyright \xA9 1998-2008 Brian Gladman. All Rights Reserved.\r\n"
- L"Copyright \xA9 1995-2017 Jean-loup Gailly and Mark Adler.\r\n"
+ L"Copyright \xA9 1995-2023 Jean-loup Gailly and Mark Adler.\r\n"
L"Copyright \xA9 2016 Disk Cryptography Services for EFI (DCS), Alex Kolotnikov.\r\n"
- L"Copyright \xA9 1999-2017 Dieter Baron and Thomas Klausner.\r\n"
+ L"Copyright \xA9 1999-2023 Dieter Baron and Thomas Klausner.\r\n"
L"Copyright \xA9 2013, Alexey Degtyarev. All rights reserved.\r\n"
L"Copyright \xA9 1999-2016 Jack Lloyd. All rights reserved.\r\n"
L"Copyright \xA9 2013-2019 Stephan Mueller <smueller@chronox.de>\r\n"
- L"Copyright \xA9 1999-2021 Igor Pavlov\r\n\r\n"
+ L"Copyright \xA9 1999-2023 Igor Pavlov\r\n\r\n"
L"This software as a whole:\r\n"
- L"Copyright \xA9 2013-2022 IDRIX. All rights reserved.\r\n\r\n"
+ L"Copyright \xA9 2013-2024 IDRIX. All rights reserved.\r\n\r\n"
L"An IDRIX Release");
@@ -3281,7 +3283,7 @@ static LRESULT CALLBACK NonInstallUacWndProc (HWND hWnd, UINT message, WPARAM wP
return DefWindowProcW (hWnd, message, wParam, lParam);
}
-BOOL LaunchElevatedProcess (HWND hwndDlg, const wchar_t* szModPath, const wchar_t* args)
+BOOL LaunchElevatedProcess (HWND hwndDlg, const wchar_t* szModPath, const wchar_t* args, BOOL exitSleep)
{
wchar_t newCmdLine[4096];
WNDCLASSEXW wcex;
@@ -3315,7 +3317,8 @@ BOOL LaunchElevatedProcess (HWND hwndDlg, const wchar_t* szModPath, const wchar_
}
else
{
- Sleep (2000);
+ if (exitSleep)
+ Sleep (2000);
return TRUE;
}
}
@@ -3908,7 +3911,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
LoadLanguageFile ();
-#ifndef SETUP
+#if !defined(SETUP) & !defined(VCPASSCHANGER)
// UAC elevation moniker cannot be used in portable mode.
// A new instance of the application must be created with elevated privileges.
if (IsNonInstallMode () && !IsAdmin () && IsUacSupported ())
@@ -3921,7 +3924,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
}
- if (LaunchElevatedProcess (NULL, modPath, lpszCommandLine))
+ if (LaunchElevatedProcess (NULL, modPath, lpszCommandLine, TRUE))
exit (0);
else
exit (1);
@@ -5124,7 +5127,7 @@ error:
return bOK;
}
-
+#ifndef VCPASSCHANGER
// Install and start driver service and mark it for removal (non-install mode)
static int DriverLoad ()
{
@@ -5201,7 +5204,6 @@ static int DriverLoad ()
return !res ? ERR_OS_ERROR : ERROR_SUCCESS;
}
-
BOOL DriverUnload ()
{
MOUNT_LIST_STRUCT driver;
@@ -5304,13 +5306,13 @@ error:
return FALSE;
}
-
+#endif
int DriverAttach (void)
{
/* Try to open a handle to the device driver. It will be closed later. */
-#ifndef SETUP
+#if !defined(SETUP) && !defined(VCPASSCHANGER)
int nLoadRetryCount = 0;
start:
@@ -5321,7 +5323,7 @@ start:
if (hDriver == INVALID_HANDLE_VALUE)
{
-#ifndef SETUP
+#if !defined(SETUP) && !defined(VCPASSCHANGER)
LoadSysEncSettings ();
@@ -5405,7 +5407,7 @@ load:
if (!bResult)
bResult = DeviceIoControl (hDriver, TC_IOCTL_LEGACY_GET_DRIVER_VERSION, NULL, 0, &DriverVersion, sizeof (DriverVersion), &dwResult, NULL);
-#ifndef SETUP // Don't check version during setup to allow removal of another version
+#if !defined(SETUP) && !defined(VCPASSCHANGER) // Don't check version during setup to allow removal of another version
if (bResult == FALSE)
{
return ERR_OS_ERROR;
@@ -11157,7 +11159,7 @@ BOOL IsServerOS ()
return (osVer.wProductType == VER_NT_SERVER || osVer.wProductType == VER_NT_DOMAIN_CONTROLLER);
}
-
+#ifndef VCPASSCHANGER
// Returns TRUE, if the currently running operating system is installed in a hidden volume. If it's not, or if
// there's an error, returns FALSE.
BOOL IsHiddenOSRunning (void)
@@ -11181,6 +11183,7 @@ BOOL IsHiddenOSRunning (void)
return hiddenOSRunning;
}
+#endif
BOOL EnableWow64FsRedirection (BOOL enable)
@@ -13731,6 +13734,7 @@ void HandleShowPasswordFieldAction (HWND hwndDlg, UINT checkBoxId, UINT edit1Id,
}
}
+#ifndef VCPASSCHANGER
void RegisterDriverInf (bool registerFilter, const string& filter, const string& filterReg, HWND ParentWindow, HKEY regKey)
{
wstring infFileName = GetTempPathString() + L"\\veracrypt_driver_setup.inf";
@@ -13752,7 +13756,7 @@ void RegisterDriverInf (bool registerFilter, const string& filter, const string&
throw_sys_if (!SetupInstallFromInfSectionWFn (ParentWindow, hInf, L"veracrypt", SPINST_REGISTRY, regKey, NULL, 0, NULL, NULL, NULL, NULL));
}
-
+#endif
HKEY OpenDeviceClassRegKey (const GUID *deviceClassGuid)
{
return SetupDiOpenClassRegKeyFn (deviceClassGuid, KEY_READ | KEY_WRITE);
@@ -13973,7 +13977,7 @@ BOOL DeleteDirectory (const wchar_t* szDirName)
return bStatus;
}
-#if defined (TCMOUNT) || defined (VOLFORMAT)
+#if defined (TCMOUNT) || defined (VOLFORMAT) || defined(VCPASSCHANGER)
/*********************************************************************/
static BOOL GenerateRandomString (HWND hwndDlg, LPTSTR szName, DWORD maxCharsCount)
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 362b2d6d..a2eae451 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -571,7 +571,7 @@ void AllowMessageInUIPI (UINT msg);
BOOL IsRepeatedByteArray (byte value, const byte* buffer, size_t bufferSize);
BOOL TranslateVolumeID (HWND hwndDlg, wchar_t* pathValue, size_t cchPathValue);
BOOL CopyTextToClipboard (const wchar_t* txtValue);
-BOOL LaunchElevatedProcess (HWND hwndDlg, const wchar_t* szModPath, const wchar_t* args);
+BOOL LaunchElevatedProcess (HWND hwndDlg, const wchar_t* szModPath, const wchar_t* args, BOOL exitSleep);
BOOL GetFreeDriveLetter(WCHAR* pCh);
BOOL SetPrivilege(LPTSTR szPrivilegeName, BOOL bEnable);
BOOL DeleteDirectory (const wchar_t* szDirName);
diff --git a/src/Common/Language.c b/src/Common/Language.c
index 844f4dad..ce53b8ee 100644
--- a/src/Common/Language.c
+++ b/src/Common/Language.c
@@ -22,6 +22,10 @@
#include "../Mount/Resource.h"
#endif
+#if defined(VCPASSCHANGER)
+#include "../Mount/Resource.h"
+#endif
+
#ifdef VOLFORMAT
#include "../Format/Resource.h"
#endif
@@ -194,7 +198,7 @@ static BOOL LoadLanguageData (int resourceid, BOOL bForceSetPreferredLanguage, B
char *xmlElements[] = {"entry", 0};
-#ifdef TCMOUNT
+#if defined(TCMOUNT) || defined(VCPASSCHANGER)
int headers[] = { IDR_COMMON_RSRC_HEADER, IDR_MOUNT_RSRC_HEADER, 0 };
#endif
@@ -225,6 +229,7 @@ static BOOL LoadLanguageData (int resourceid, BOOL bForceSetPreferredLanguage, B
// Required TrueCrypt version
XmlGetAttributeText (xml, "prog-version", attr, sizeof (attr));
+#ifndef VCPASSCHANGER
// Check version of external language file
if (defaultLangParsed && strcmp (attr, VERSION_STRING) && strcmp (attr, "DEBUG"))
{
@@ -234,7 +239,7 @@ static BOOL LoadLanguageData (int resourceid, BOOL bForceSetPreferredLanguage, B
MessageBoxW (NULL, m, L"VeraCrypt", MB_ICONERROR);
continue;
}
-
+#endif
// Search language id in language file
if (defaultLangParsed)
{
diff --git a/src/Common/Tcdefs.h b/src/Common/Tcdefs.h
index 0b3025ed..e288a2a1 100644
--- a/src/Common/Tcdefs.h
+++ b/src/Common/Tcdefs.h
@@ -69,9 +69,9 @@ extern unsigned short _rotl16(unsigned short value, unsigned char shift);
#define VERSION_NUM 0x0125
// Release date
-#define TC_STR_RELEASE_DATE L"February 19, 2022"
-#define TC_RELEASE_DATE_YEAR 2022
-#define TC_RELEASE_DATE_MONTH 02
+#define TC_STR_RELEASE_DATE L"August 11, 2024"
+#define TC_RELEASE_DATE_YEAR 2024
+#define TC_RELEASE_DATE_MONTH 08
#define BYTES_PER_KB 1024LL
#define BYTES_PER_MB 1048576LL
@@ -338,7 +338,7 @@ extern BOOLEAN VC_KeAreAllApcsDisabled (VOID);
#ifndef TC_LOCAL_WIN32_WINNT_OVERRIDE
# undef _WIN32_WINNT
-# define _WIN32_WINNT 0x0501 /* Does not apply to the driver */
+# define _WIN32_WINNT 0x0601 /* Does not apply to the driver */
#endif
#include <windows.h> /* Windows header */