VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount/MainCom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mount/MainCom.cpp')
-rw-r--r--src/Mount/MainCom.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Mount/MainCom.cpp b/src/Mount/MainCom.cpp
index 9226e15b..ce6803ac 100644
--- a/src/Mount/MainCom.cpp
+++ b/src/Mount/MainCom.cpp
@@ -181,60 +181,65 @@ public:
virtual DWORD STDMETHODCALLTYPE RestoreEfiSystemLoader ()
{
return BaseCom::RestoreEfiSystemLoader ();
}
virtual DWORD STDMETHODCALLTYPE GetEfiBootDeviceNumber (BSTR* pSdn)
{
return BaseCom::GetEfiBootDeviceNumber (pSdn);
}
virtual DWORD STDMETHODCALLTYPE GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded)
{
return BaseCom::GetSecureBootConfig (pSecureBootEnabled, pVeraCryptKeysLoaded);
}
virtual DWORD STDMETHODCALLTYPE WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMessage, int pim, int hashAlg)
{
return BaseCom::WriteEfiBootSectorUserConfig (userConfig, customUserMessage,pim, hashAlg);
}
virtual DWORD STDMETHODCALLTYPE UpdateSetupConfigFile (BOOL bForInstall)
{
return BaseCom::UpdateSetupConfigFile (bForInstall);
}
virtual DWORD STDMETHODCALLTYPE NotifyService (DWORD dwNotifyCode)
{
return BaseCom::NotifyService (dwNotifyCode);
}
+ virtual DWORD STDMETHODCALLTYPE FastFileResize (BSTR filePath, __int64 fileSize)
+ {
+ return BaseCom::FastFileResize (filePath, fileSize);
+ }
+
protected:
DWORD MessageThreadId;
LONG RefCount;
};
extern "C" BOOL ComServerMain ()
{
SetProcessShutdownParameters (0x100, 0);
TrueCryptFactory<TrueCryptMainCom> factory (GetCurrentThreadId ());
DWORD cookie;
if (IsUacSupported ())
UacElevated = TRUE;
if (CoRegisterClassObject (CLSID_TrueCryptMainCom, (LPUNKNOWN) &factory,
CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie) != S_OK)
return FALSE;
MSG msg;
while (int r = GetMessageW (&msg, NULL, 0, 0))
{
if (r == -1)
return FALSE;
TranslateMessage (&msg);
DispatchMessageW (&msg);
if (msg.message == WM_APP
@@ -243,102 +248,102 @@ extern "C" BOOL ComServerMain ()
break;
}
CoRevokeClassObject (cookie);
return TRUE;
}
static BOOL ComGetInstance (HWND hWnd, ITrueCryptMainCom **tcServer)
{
return ComGetInstanceBase (hWnd, CLSID_TrueCryptMainCom, IID_ITrueCryptMainCom, (void **) tcServer);
}
ITrueCryptMainCom *GetElevatedInstance (HWND parent)
{
ITrueCryptMainCom *instance;
if (!ComGetInstance (parent, &instance))
throw UserAbort (SRC_POS);
return instance;
}
extern "C" int UacBackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, wchar_t *lpszVolume)
{
CComPtr<ITrueCryptMainCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hwndDlg, &tc))
{
CComBSTR volumeBstr;
BSTR bstr = W2BSTR(lpszVolume);
if (bstr)
{
volumeBstr.Attach (bstr);
r = tc->BackupVolumeHeader ((__int64) hwndDlg, bRequireConfirmation, volumeBstr);
}
else
r = ERR_OUTOFMEMORY;
}
else
r = -1;
CoUninitialize ();
return r;
}
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))
{
CComBSTR volumeBstr;
BSTR bstr = W2BSTR(lpszVolume);
if (bstr)
{
volumeBstr.Attach (bstr);
r = tc->RestoreVolumeHeader ((__int64) hwndDlg, volumeBstr);
}
else
r = ERR_OUTOFMEMORY;
}
else
r = -1;
CoUninitialize ();
return r;
}
extern "C" int UacChangePwd (wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg)
{
CComPtr<ITrueCryptMainCom> tc;
int r;
- CoInitialize (NULL);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (ComGetInstance (hwndDlg, &tc))
{
CComBSTR bstrVolume (lpszVolume);
WaitCursor ();
r = tc->ChangePasswordEx3 (bstrVolume, oldPassword, old_pkcs5, old_pim, newPassword, pkcs5, pim, wipePassCount, (__int64) hwndDlg);
NormalCursor ();
}
else
r = -1;
CoUninitialize ();
return r;
}