mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Windows: replace CoInitialize calls with CoInitializeEx
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user