VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2023-09-11 00:03:28 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2023-09-11 00:03:28 +0200
commitd2f2defca9eac0d7f779296bf52f36b161fc6b31 (patch)
tree37146ca9339171563af3916e5d571c55e8812f42 /src
parentaa311a6fad13357772c6e3c85a4bfe393df9382e (diff)
downloadVeraCrypt-d2f2defca9eac0d7f779296bf52f36b161fc6b31.tar.gz
VeraCrypt-d2f2defca9eac0d7f779296bf52f36b161fc6b31.zip
Windows: replace CoInitialize calls with CoInitializeEx
Diffstat (limited to 'src')
-rw-r--r--src/Common/BootEncryption.cpp2
-rw-r--r--src/Common/Dlgcode.c8
-rw-r--r--src/Format/FormatCom.cpp10
-rw-r--r--src/Mount/MainCom.cpp6
-rw-r--r--src/Mount/Mount.c2
-rw-r--r--src/SetupDLL/Setup.c2
6 files changed, 15 insertions, 15 deletions
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index 752fac01..ddee14b1 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -712,7 +712,7 @@ namespace VeraCrypt
if (!ElevatedComInstance || ElevatedComInstanceThreadId != GetCurrentThreadId())
{
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
ElevatedComInstance = GetElevatedInstance (GetActiveWindow() ? GetActiveWindow() : MainDlg);
ElevatedComInstanceThreadId = GetCurrentThreadId();
}
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 3dd508fa..7282b2ec 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -3487,7 +3487,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
hInst = hInstance;
SetErrorMode (SetErrorMode (0) | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
#ifndef SETUP
// Application ID
@@ -14351,7 +14351,7 @@ HRESULT GetShellDispatchFromView(IShellView *psv, REFIID riid, void **ppv)
HRESULT ShellExecInExplorerProcess(PCWSTR pszFile)
{
IShellView *psv;
- CoInitialize(NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
HRESULT hr = GetShellViewForDesktop(IID_PPV_ARGS(&psv));
if (SUCCEEDED(hr))
{
@@ -14526,7 +14526,7 @@ BitLockerEncryptionStatus GetBitLockerEncryptionStatus(WCHAR driveLetter)
wchar_t szDllPath[MAX_PATH] = { 0 };
HMODULE hPropsys = NULL;
- CoInitialize(NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (GetSystemDirectory(szDllPath, MAX_PATH))
StringCchCatW(szDllPath, MAX_PATH, L"\\Propsys.dll");
@@ -15082,7 +15082,7 @@ bool GetKbList (std::vector<std::wstring>& kbList)
kbList.clear();
// Initialize COM.
- hres = CoInitialize(NULL);
+ hres = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (FAILED(hres))
{
return false;
diff --git a/src/Format/FormatCom.cpp b/src/Format/FormatCom.cpp
index d696f00f..90333f23 100644
--- a/src/Format/FormatCom.cpp
+++ b/src/Format/FormatCom.cpp
@@ -255,7 +255,7 @@ extern "C" int UacFormatNtfs (HWND hWnd, int driveNo, int clusterSize)
CComPtr<ITrueCryptFormatCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hWnd, &tc))
r = tc->FormatNtfs (driveNo, clusterSize);
@@ -272,7 +272,7 @@ extern "C" int UacFormatFs (HWND hWnd, int driveNo, int clusterSize, int fsType)
CComPtr<ITrueCryptFormatCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hWnd, &tc))
r = tc->FormatFs (driveNo, clusterSize, fsType);
@@ -290,7 +290,7 @@ extern "C" int UacAnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 h
CComPtr<ITrueCryptFormatCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hwndDlg, &tc))
r = tc->AnalyzeHiddenVolumeHost ((__int64) hwndDlg, driveNo, hiddenVolHostSize, realClusterSize, nbrFreeClusters);
@@ -307,7 +307,7 @@ extern "C" BOOL UacWriteLocalMachineRegistryDword (HWND hwndDlg, wchar_t *keyPat
CComPtr<ITrueCryptFormatCom> tc;
int r = 0;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hwndDlg, &tc))
{
@@ -345,7 +345,7 @@ extern "C" DWORD UacFastFileCreation (HWND hWnd, wchar_t* filePath, __int64 file
CComPtr<ITrueCryptFormatCom> tc;
DWORD r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hWnd, &tc))
{
diff --git a/src/Mount/MainCom.cpp b/src/Mount/MainCom.cpp
index aa628f57..ce6803ac 100644
--- a/src/Mount/MainCom.cpp
+++ b/src/Mount/MainCom.cpp
@@ -275,7 +275,7 @@ extern "C" int UacBackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, w
CComPtr<ITrueCryptMainCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hwndDlg, &tc))
{
@@ -303,7 +303,7 @@ extern "C" int UacRestoreVolumeHeader (HWND hwndDlg, wchar_t *lpszVolume)
CComPtr<ITrueCryptMainCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hwndDlg, &tc))
{
@@ -331,7 +331,7 @@ extern "C" int UacChangePwd (wchar_t *lpszVolume, Password *oldPassword, int old
CComPtr<ITrueCryptMainCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hwndDlg, &tc))
{
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index e41d9a08..f5c22a9e 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -295,7 +295,7 @@ static std::vector<MSXML2::IXMLDOMNodePtr> GetReadChildNodes (MSXML2::IXMLDOMNod
static bool validateDcsPropXml(const char* xmlData)
{
bool bValid = false;
- HRESULT hr = CoInitialize(NULL);
+ HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if(FAILED(hr))
return false;
else
diff --git a/src/SetupDLL/Setup.c b/src/SetupDLL/Setup.c
index 6a288a5c..1c3782dd 100644
--- a/src/SetupDLL/Setup.c
+++ b/src/SetupDLL/Setup.c
@@ -1994,7 +1994,7 @@ BOOL InitDll (MSIHANDLE hInstaller)
InitGlobalLocks ();
SetErrorMode (SetErrorMode (0) | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
// Force language to english to read strings from the default Language.xml embedded in the DLL.
SetPreferredLangId ("en");