From 0d23312886b7787eb4b7de2d788b7de4d021e139 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Fri, 22 May 2015 18:19:13 +0200 Subject: Windows: Modifications to build 64-bit versions of VeraCrypt.exe & "VeraCrypt Format.exe". --- src/Common/Dlgcode.c | 8 +- src/Common/Registry.c | 4 +- src/Common/Registry.h | 2 +- src/Crypto/Crypto.vcproj | 215 ++++++++++++++++++++++++ src/ExpandVolume/ExpandVolume.vcproj | 305 ++++++++++++++++++++++++++++++++++- src/Format/Format.vcproj | 286 +++++++++++++++++++++++++++++++- src/Mount/Mount.c | 2 +- src/Mount/Mount.vcproj | 274 ++++++++++++++++++++++++++++++- src/VeraCrypt.sln | 216 +++++++++++++++++++++++++ 9 files changed, 1292 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index b433aa04..0c5395c9 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -7668,7 +7668,7 @@ BOOL IsNonInstallMode () // The following test may be unreliable in some cases (e.g. after the user selects restore "Last Known Good // Configuration" from the Windows boot menu). - if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", 0, KEY_READ, &hkey) == ERROR_SUCCESS) + if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", 0, KEY_READ | KEY_WOW64_32KEY, &hkey) == ERROR_SUCCESS) { RegCloseKey (hkey); return FALSE; @@ -10615,12 +10615,12 @@ std::string HarddiskVolumePathToPartitionPath (const std::string &harddiskVolume } -BOOL IsApplicationInstalled (const char *appName) +BOOL IsApplicationInstalled (const char *appName, BOOL b32bitApp) { const char *uninstallRegName = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; BOOL installed = FALSE; HKEY unistallKey; - LONG res = RegOpenKeyEx (HKEY_LOCAL_MACHINE, uninstallRegName, 0, KEY_READ | KEY_WOW64_64KEY, &unistallKey); + LONG res = RegOpenKeyEx (HKEY_LOCAL_MACHINE, uninstallRegName, 0, KEY_READ | b32bitApp? KEY_WOW64_32KEY: KEY_WOW64_64KEY, &unistallKey); if (res != ERROR_SUCCESS) { SetLastError (res); @@ -10635,7 +10635,7 @@ BOOL IsApplicationInstalled (const char *appName) if (strstr (regName, "{") == regName) { regNameSize = sizeof (regName); - if (!ReadLocalMachineRegistryStringNonReflected ((string (uninstallRegName) + "\\" + regName).c_str(), "DisplayName", regName, ®NameSize)) + if (!ReadLocalMachineRegistryStringNonReflected ((string (uninstallRegName) + "\\" + regName).c_str(), "DisplayName", regName, ®NameSize, b32bitApp)) regName[0] = 0; } diff --git a/src/Common/Registry.c b/src/Common/Registry.c index 0b17dc51..07ca6b10 100644 --- a/src/Common/Registry.c +++ b/src/Common/Registry.c @@ -65,12 +65,12 @@ BOOL ReadLocalMachineRegistryString (const char *subKey, char *name, char *str, return type == REG_SZ; } -BOOL ReadLocalMachineRegistryStringNonReflected (const char *subKey, char *name, char *str, DWORD *size) +BOOL ReadLocalMachineRegistryStringNonReflected (const char *subKey, char *name, char *str, DWORD *size, BOOL b32bitApp) { HKEY hkey = 0; DWORD type; - if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, subKey, 0, KEY_READ | KEY_WOW64_64KEY, &hkey) != ERROR_SUCCESS) + if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, subKey, 0, KEY_READ | (b32bitApp? KEY_WOW64_32KEY: KEY_WOW64_64KEY), &hkey) != ERROR_SUCCESS) return FALSE; if (RegQueryValueEx (hkey, name, NULL, &type, (BYTE *) str, size) != ERROR_SUCCESS) diff --git a/src/Common/Registry.h b/src/Common/Registry.h index 693ddc0e..c0734d95 100644 --- a/src/Common/Registry.h +++ b/src/Common/Registry.h @@ -13,7 +13,7 @@ extern "C" { BOOL ReadLocalMachineRegistryDword (char *subKey, char *name, DWORD *value); BOOL ReadLocalMachineRegistryMultiString (char *subKey, char *name, char *value, DWORD *size); BOOL ReadLocalMachineRegistryString (const char *subKey, char *name, char *value, DWORD *size); -BOOL ReadLocalMachineRegistryStringNonReflected (const char *subKey, char *name, char *str, DWORD *size); +BOOL ReadLocalMachineRegistryStringNonReflected (const char *subKey, char *name, char *str, DWORD *size, BOOL b32bitApp); int ReadRegistryInt (char *subKey, char *name, int defaultValue); char *ReadRegistryString (char *subKey, char *name, char *defaultValue, char *str, int maxLen); DWORD ReadRegistryBytes (char *path, char *name, char *value, int maxLen); diff --git a/src/Crypto/Crypto.vcproj b/src/Crypto/Crypto.vcproj index b28feb1e..dfa99e0e 100644 --- a/src/Crypto/Crypto.vcproj +++ b/src/Crypto/Crypto.vcproj @@ -12,6 +12,9 @@ + @@ -150,6 +153,142 @@ Name="VCPostBuildEventTool" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -180,6 +319,62 @@ Outputs="$(TargetDir)\$(InputName).obj" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -105,7 +108,7 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -659,6 +944,22 @@ Name="VCResourceCompilerTool" /> + + + + + + + @@ -189,6 +192,181 @@ CommandLine="copy Release\VeraCryptFormat.exe "..\Release\Setup Files\VeraCrypt Format.exe"" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -225,6 +403,22 @@ CompileAs="2" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - @@ -594,6 +848,10 @@ RelativePath="..\Boot\Windows\Rescue_Serpent\BootLoader.com.gz" > + + @@ -645,6 +903,22 @@ Name="VCResourceCompilerTool" /> + + + + + + + @@ -197,6 +200,189 @@ CommandLine="copy Release\VeraCrypt.exe "..\Release\Setup Files"" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -241,6 +427,22 @@ CompileAs="2" /> + + + + + + + + + + + + + + + + + + + + + + + + - - @@ -605,6 +851,10 @@ RelativePath="..\Boot\Windows\Release_Serpent\BootLoader.com.gz" > + + @@ -656,6 +906,22 @@ Name="VCResourceCompilerTool" /> + + + + + +