VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2025-02-08 12:00:05 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2025-02-08 12:00:05 +0100
commit974a3909ecaf0de63f7ef36b2ed6d1e0a7804267 (patch)
treed2630796d62aff1b0e53499de01930dcdb61ea4d /src
parenta2f11e11024a104dabf6921cd276baa4255473e0 (diff)
downloadVeraCrypt-master.tar.gz
VeraCrypt-master.zip
Windows: remove dependency towards Mount/Format when building setup to fix Win32 build issue (#1487)HEADmaster
MainCom_i.c and FormatCom_i.c are needed only for mount/format type libraries GUIDs. Since they don't change, we just define them directly.
Diffstat (limited to 'src')
-rw-r--r--src/Setup/ComSetup.cpp9
-rw-r--r--src/SetupDLL/ComSetup.cpp9
2 files changed, 14 insertions, 4 deletions
diff --git a/src/Setup/ComSetup.cpp b/src/Setup/ComSetup.cpp
index 9ae0a23d..8c0e93af 100644
--- a/src/Setup/ComSetup.cpp
+++ b/src/Setup/ComSetup.cpp
@@ -6,42 +6,47 @@
Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
code distribution packages.
*/
#define TC_MAIN_COM_VERSION_MAJOR 2
#define TC_MAIN_COM_VERSION_MINOR 13
#define TC_FORMAT_COM_VERSION_MAJOR 2
#define TC_FORMAT_COM_VERSION_MINOR 10
#include <atlbase.h>
#include <comdef.h>
#include <statreg.h>
#include <windows.h>
#include "ComSetup.h"
#include "Dlgcode.h"
#include "Resource.h"
-#include "../Mount/MainCom_i.c"
-#include "../Format/FormatCom_i.c"
+
+#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
+ EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
+
+// Define GUIDs of "VeraCrypt.exe and" "VeraCrypt Format.exe" type libraries
+MIDL_DEFINE_GUID(GUID, LIBID_TrueCryptMainCom, 0x9ACF6176, 0x5FC4, 0x4690, 0xA0, 0x25, 0xB3, 0x30, 0x6A, 0x50, 0xEB, 0x6A);
+MIDL_DEFINE_GUID(GUID, LIBID_TrueCryptFormatCom, 0x56327DDA, 0xF1A7, 0x4e13, 0xB1, 0x28, 0x52, 0x0D, 0x12, 0x9B, 0xDE, 0xF6);
extern "C" BOOL RegisterComServers (wchar_t *modulePath)
{
BOOL ret = TRUE;
wchar_t mainModule[1024], formatModule[1024];
CComPtr<ITypeLib> tl, tl2;
wsprintfW (mainModule, L"%sVeraCrypt.exe", modulePath);
wsprintfW (formatModule, L"%sVeraCrypt Format.exe", 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 = 9; i >= 1; i--)
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-i, 0, SYS_WIN32);
for (WORD i = 6; 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];
diff --git a/src/SetupDLL/ComSetup.cpp b/src/SetupDLL/ComSetup.cpp
index 39a0339e..e1ab2cfd 100644
--- a/src/SetupDLL/ComSetup.cpp
+++ b/src/SetupDLL/ComSetup.cpp
@@ -6,42 +6,47 @@
Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2025 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
code distribution packages.
*/
#define TC_MAIN_COM_VERSION_MAJOR 2
#define TC_MAIN_COM_VERSION_MINOR 11
#define TC_FORMAT_COM_VERSION_MAJOR 2
#define TC_FORMAT_COM_VERSION_MINOR 9
#include <atlbase.h>
#include <comdef.h>
#include <statreg.h>
#include <windows.h>
#include "ComSetup.h"
#include "Dlgcode.h"
#include "Resource.h"
-#include "../Mount/MainCom_i.c"
-#include "../Format/FormatCom_i.c"
+
+#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
+ EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
+
+// Define GUIDs of "VeraCrypt.exe and" "VeraCrypt Format.exe" type libraries
+MIDL_DEFINE_GUID(GUID, LIBID_TrueCryptMainCom, 0x9ACF6176, 0x5FC4, 0x4690, 0xA0, 0x25, 0xB3, 0x30, 0x6A, 0x50, 0xEB, 0x6A);
+MIDL_DEFINE_GUID(GUID, LIBID_TrueCryptFormatCom, 0x56327DDA, 0xF1A7, 0x4e13, 0xB1, 0x28, 0x52, 0x0D, 0x12, 0x9B, 0xDE, 0xF6);
/*
* Same as RegisterComServers() in Setup project, but
* instead of using GetModuleFileNameW() to get this
* DLL's path as setupModule which will not work because
* the DLL is embedded in the binary of the MSI,
* we ship the empty version of 'VeraCrypt Setup.exe'
* as 'VeraCrypt COMReg.exe' and use it.
*/
extern "C" BOOL RegisterComServers (wchar_t *modulePath)
{
BOOL ret = TRUE;
wchar_t mainModule[1024], formatModule[1024], setupModule[1024];
CComPtr<ITypeLib> tl, tl2;
wsprintfW (mainModule, L"%sVeraCrypt.exe", modulePath);
wsprintfW (formatModule, L"%sVeraCrypt Format.exe", modulePath);
wsprintfW (setupModule, L"%sVeraCrypt COMReg.exe", modulePath);
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR, 0, SYS_WIN32);