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())
|
if (!ElevatedComInstance || ElevatedComInstanceThreadId != GetCurrentThreadId())
|
||||||
{
|
{
|
||||||
CoInitialize (NULL);
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
ElevatedComInstance = GetElevatedInstance (GetActiveWindow() ? GetActiveWindow() : MainDlg);
|
ElevatedComInstance = GetElevatedInstance (GetActiveWindow() ? GetActiveWindow() : MainDlg);
|
||||||
ElevatedComInstanceThreadId = GetCurrentThreadId();
|
ElevatedComInstanceThreadId = GetCurrentThreadId();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3487,7 +3487,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
|
|||||||
hInst = hInstance;
|
hInst = hInstance;
|
||||||
|
|
||||||
SetErrorMode (SetErrorMode (0) | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
|
SetErrorMode (SetErrorMode (0) | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
|
||||||
CoInitialize (NULL);
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
|
|
||||||
#ifndef SETUP
|
#ifndef SETUP
|
||||||
// Application ID
|
// Application ID
|
||||||
@@ -14351,7 +14351,7 @@ HRESULT GetShellDispatchFromView(IShellView *psv, REFIID riid, void **ppv)
|
|||||||
HRESULT ShellExecInExplorerProcess(PCWSTR pszFile)
|
HRESULT ShellExecInExplorerProcess(PCWSTR pszFile)
|
||||||
{
|
{
|
||||||
IShellView *psv;
|
IShellView *psv;
|
||||||
CoInitialize(NULL);
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
HRESULT hr = GetShellViewForDesktop(IID_PPV_ARGS(&psv));
|
HRESULT hr = GetShellViewForDesktop(IID_PPV_ARGS(&psv));
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
@@ -14526,7 +14526,7 @@ BitLockerEncryptionStatus GetBitLockerEncryptionStatus(WCHAR driveLetter)
|
|||||||
wchar_t szDllPath[MAX_PATH] = { 0 };
|
wchar_t szDllPath[MAX_PATH] = { 0 };
|
||||||
HMODULE hPropsys = NULL;
|
HMODULE hPropsys = NULL;
|
||||||
|
|
||||||
CoInitialize(NULL);
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
|
|
||||||
if (GetSystemDirectory(szDllPath, MAX_PATH))
|
if (GetSystemDirectory(szDllPath, MAX_PATH))
|
||||||
StringCchCatW(szDllPath, MAX_PATH, L"\\Propsys.dll");
|
StringCchCatW(szDllPath, MAX_PATH, L"\\Propsys.dll");
|
||||||
@@ -15082,7 +15082,7 @@ bool GetKbList (std::vector<std::wstring>& kbList)
|
|||||||
kbList.clear();
|
kbList.clear();
|
||||||
|
|
||||||
// Initialize COM.
|
// Initialize COM.
|
||||||
hres = CoInitialize(NULL);
|
hres = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ extern "C" int UacFormatNtfs (HWND hWnd, int driveNo, int clusterSize)
|
|||||||
CComPtr<ITrueCryptFormatCom> tc;
|
CComPtr<ITrueCryptFormatCom> tc;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
CoInitialize (NULL);
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
|
|
||||||
if (ComGetInstance (hWnd, &tc))
|
if (ComGetInstance (hWnd, &tc))
|
||||||
r = tc->FormatNtfs (driveNo, clusterSize);
|
r = tc->FormatNtfs (driveNo, clusterSize);
|
||||||
@@ -272,7 +272,7 @@ extern "C" int UacFormatFs (HWND hWnd, int driveNo, int clusterSize, int fsType)
|
|||||||
CComPtr<ITrueCryptFormatCom> tc;
|
CComPtr<ITrueCryptFormatCom> tc;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
CoInitialize (NULL);
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
|
|
||||||
if (ComGetInstance (hWnd, &tc))
|
if (ComGetInstance (hWnd, &tc))
|
||||||
r = tc->FormatFs (driveNo, clusterSize, fsType);
|
r = tc->FormatFs (driveNo, clusterSize, fsType);
|
||||||
@@ -290,7 +290,7 @@ extern "C" int UacAnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 h
|
|||||||
CComPtr<ITrueCryptFormatCom> tc;
|
CComPtr<ITrueCryptFormatCom> tc;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
CoInitialize (NULL);
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
|
|
||||||
if (ComGetInstance (hwndDlg, &tc))
|
if (ComGetInstance (hwndDlg, &tc))
|
||||||
r = tc->AnalyzeHiddenVolumeHost ((__int64) hwndDlg, driveNo, hiddenVolHostSize, realClusterSize, nbrFreeClusters);
|
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;
|
CComPtr<ITrueCryptFormatCom> tc;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
CoInitialize (NULL);
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
|
|
||||||
if (ComGetInstance (hwndDlg, &tc))
|
if (ComGetInstance (hwndDlg, &tc))
|
||||||
{
|
{
|
||||||
@@ -345,7 +345,7 @@ extern "C" DWORD UacFastFileCreation (HWND hWnd, wchar_t* filePath, __int64 file
|
|||||||
CComPtr<ITrueCryptFormatCom> tc;
|
CComPtr<ITrueCryptFormatCom> tc;
|
||||||
DWORD r;
|
DWORD r;
|
||||||
|
|
||||||
CoInitialize (NULL);
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
|
|
||||||
if (ComGetInstance (hWnd, &tc))
|
if (ComGetInstance (hWnd, &tc))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ extern "C" int UacBackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, w
|
|||||||
CComPtr<ITrueCryptMainCom> tc;
|
CComPtr<ITrueCryptMainCom> tc;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
CoInitialize (NULL);
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
|
|
||||||
if (ComGetInstance (hwndDlg, &tc))
|
if (ComGetInstance (hwndDlg, &tc))
|
||||||
{
|
{
|
||||||
@@ -303,7 +303,7 @@ extern "C" int UacRestoreVolumeHeader (HWND hwndDlg, wchar_t *lpszVolume)
|
|||||||
CComPtr<ITrueCryptMainCom> tc;
|
CComPtr<ITrueCryptMainCom> tc;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
CoInitialize (NULL);
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
|
|
||||||
if (ComGetInstance (hwndDlg, &tc))
|
if (ComGetInstance (hwndDlg, &tc))
|
||||||
{
|
{
|
||||||
@@ -331,7 +331,7 @@ extern "C" int UacChangePwd (wchar_t *lpszVolume, Password *oldPassword, int old
|
|||||||
CComPtr<ITrueCryptMainCom> tc;
|
CComPtr<ITrueCryptMainCom> tc;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
CoInitialize (NULL);
|
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
|
|
||||||
if (ComGetInstance (hwndDlg, &tc))
|
if (ComGetInstance (hwndDlg, &tc))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ static std::vector<MSXML2::IXMLDOMNodePtr> GetReadChildNodes (MSXML2::IXMLDOMNod
|
|||||||
static bool validateDcsPropXml(const char* xmlData)
|
static bool validateDcsPropXml(const char* xmlData)
|
||||||
{
|
{
|
||||||
bool bValid = false;
|
bool bValid = false;
|
||||||
HRESULT hr = CoInitialize(NULL);
|
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1994,7 +1994,7 @@ BOOL InitDll (MSIHANDLE hInstaller)
|
|||||||
InitGlobalLocks ();
|
InitGlobalLocks ();
|
||||||
|
|
||||||
SetErrorMode (SetErrorMode (0) | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
|
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.
|
// Force language to english to read strings from the default Language.xml embedded in the DLL.
|
||||||
SetPreferredLangId ("en");
|
SetPreferredLangId ("en");
|
||||||
|
|||||||
Reference in New Issue
Block a user