From fc37cc4a02ed13d1a73b941a9f80975600fd1b99 Mon Sep 17 00:00:00 2001 From: David Foerster Date: Tue, 10 May 2016 20:20:14 +0200 Subject: Normalize all line terminators --- src/Setup/ComSetup.cpp | 206 ++++++++++++++++++++++++------------------------- 1 file changed, 103 insertions(+), 103 deletions(-) (limited to 'src/Setup/ComSetup.cpp') diff --git a/src/Setup/ComSetup.cpp b/src/Setup/ComSetup.cpp index 5e45f8e3..24e5262f 100644 --- a/src/Setup/ComSetup.cpp +++ b/src/Setup/ComSetup.cpp @@ -1,103 +1,103 @@ -/* - Derived from source code of TrueCrypt 7.1a, which is - Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed - by the TrueCrypt License 3.0. - - Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 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 7 - -#define TC_FORMAT_COM_VERSION_MAJOR 2 -#define TC_FORMAT_COM_VERSION_MINOR 5 - -#include -#include -#include -#include -#include "ComSetup.h" -#include "Dlgcode.h" -#include "Resource.h" -#include "../Mount/MainCom_i.c" -#include "../Format/FormatCom_i.c" - - -extern "C" BOOL RegisterComServers (wchar_t *modulePath) -{ - BOOL ret = TRUE; - wchar_t mainModule[1024], formatModule[1024]; - CComPtr 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 - UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-3, 0, SYS_WIN32); - UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-2, 0, SYS_WIN32); - UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-1, 0, SYS_WIN32); - UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-1, 0, SYS_WIN32); - - wchar_t setupModule[MAX_PATH]; - GetModuleFileNameW (NULL, setupModule, sizeof (setupModule) / sizeof (setupModule[0])); - - CRegObject ro; - HRESULT r; - - if (!SUCCEEDED (r = ro.FinalConstruct ()) - || !SUCCEEDED (r = ro.AddReplacement (L"MAIN_MODULE", mainModule)) - || !SUCCEEDED (r = ro.AddReplacement (L"FORMAT_MODULE", formatModule)) - || !SUCCEEDED (r = ro.ResourceRegister (setupModule, IDR_COMREG, L"REGISTRY")) - || !SUCCEEDED (r = LoadTypeLib (mainModule, &tl)) - || !SUCCEEDED (r = RegisterTypeLib (tl, mainModule, 0)) - || !SUCCEEDED (r = LoadTypeLib (formatModule, &tl2)) - || !SUCCEEDED (r = RegisterTypeLib (tl2, formatModule, 0))) - { - MessageBox (MainDlg, _com_error (r).ErrorMessage(), _T(TC_APP_NAME), MB_ICONERROR); - ret = FALSE; - } - - ro.FinalRelease (); - return ret; -} - - -extern "C" BOOL UnregisterComServers (wchar_t *modulePath) -{ - BOOL ret; - - if (UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR, 0, SYS_WIN32) != S_OK) - return FALSE; - if (UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR, 0, SYS_WIN32) != S_OK) - return FALSE; - - // unregister older versions that may still exist - UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-3, 0, SYS_WIN32); - UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-2, 0, SYS_WIN32); - UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-1, 0, SYS_WIN32); - UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-1, 0, SYS_WIN32); - - wchar_t module[1024]; - CRegObject ro; - ro.FinalConstruct (); - - wsprintfW (module, L"%sVeraCrypt.exe", modulePath); - ro.AddReplacement (L"MAIN_MODULE", module); - - wsprintfW (module, L"%sVeraCrypt Format.exe", modulePath); - ro.AddReplacement (L"FORMAT_MODULE", module); - - wchar_t setupModule[MAX_PATH]; - GetModuleFileNameW (NULL, setupModule, sizeof (setupModule) / sizeof (setupModule[0])); - - ret = ro.ResourceUnregister (setupModule, IDR_COMREG, L"REGISTRY") == S_OK; - - ro.FinalRelease (); - return ret; -} +/* + Derived from source code of TrueCrypt 7.1a, which is + Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed + by the TrueCrypt License 3.0. + + Modifications and additions to the original source code (contained in this file) + and all other portions of this file are Copyright (c) 2013-2016 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 7 + +#define TC_FORMAT_COM_VERSION_MAJOR 2 +#define TC_FORMAT_COM_VERSION_MINOR 5 + +#include +#include +#include +#include +#include "ComSetup.h" +#include "Dlgcode.h" +#include "Resource.h" +#include "../Mount/MainCom_i.c" +#include "../Format/FormatCom_i.c" + + +extern "C" BOOL RegisterComServers (wchar_t *modulePath) +{ + BOOL ret = TRUE; + wchar_t mainModule[1024], formatModule[1024]; + CComPtr 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 + UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-3, 0, SYS_WIN32); + UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-2, 0, SYS_WIN32); + UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-1, 0, SYS_WIN32); + UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-1, 0, SYS_WIN32); + + wchar_t setupModule[MAX_PATH]; + GetModuleFileNameW (NULL, setupModule, sizeof (setupModule) / sizeof (setupModule[0])); + + CRegObject ro; + HRESULT r; + + if (!SUCCEEDED (r = ro.FinalConstruct ()) + || !SUCCEEDED (r = ro.AddReplacement (L"MAIN_MODULE", mainModule)) + || !SUCCEEDED (r = ro.AddReplacement (L"FORMAT_MODULE", formatModule)) + || !SUCCEEDED (r = ro.ResourceRegister (setupModule, IDR_COMREG, L"REGISTRY")) + || !SUCCEEDED (r = LoadTypeLib (mainModule, &tl)) + || !SUCCEEDED (r = RegisterTypeLib (tl, mainModule, 0)) + || !SUCCEEDED (r = LoadTypeLib (formatModule, &tl2)) + || !SUCCEEDED (r = RegisterTypeLib (tl2, formatModule, 0))) + { + MessageBox (MainDlg, _com_error (r).ErrorMessage(), _T(TC_APP_NAME), MB_ICONERROR); + ret = FALSE; + } + + ro.FinalRelease (); + return ret; +} + + +extern "C" BOOL UnregisterComServers (wchar_t *modulePath) +{ + BOOL ret; + + if (UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR, 0, SYS_WIN32) != S_OK) + return FALSE; + if (UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR, 0, SYS_WIN32) != S_OK) + return FALSE; + + // unregister older versions that may still exist + UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-3, 0, SYS_WIN32); + UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-2, 0, SYS_WIN32); + UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR-1, 0, SYS_WIN32); + UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR-1, 0, SYS_WIN32); + + wchar_t module[1024]; + CRegObject ro; + ro.FinalConstruct (); + + wsprintfW (module, L"%sVeraCrypt.exe", modulePath); + ro.AddReplacement (L"MAIN_MODULE", module); + + wsprintfW (module, L"%sVeraCrypt Format.exe", modulePath); + ro.AddReplacement (L"FORMAT_MODULE", module); + + wchar_t setupModule[MAX_PATH]; + GetModuleFileNameW (NULL, setupModule, sizeof (setupModule) / sizeof (setupModule[0])); + + ret = ro.ResourceUnregister (setupModule, IDR_COMREG, L"REGISTRY") == S_OK; + + ro.FinalRelease (); + return ret; +} -- cgit v1.2.3