VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/BaseCom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/BaseCom.cpp')
-rw-r--r--src/Common/BaseCom.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp
index 7a74e293..3eaaf809 100644
--- a/src/Common/BaseCom.cpp
+++ b/src/Common/BaseCom.cpp
@@ -45,12 +45,13 @@ HRESULT CreateElevatedComObject (HWND hwnd, REFGUID guid, REFIID iid, void **ppv
BOOL ComGetInstanceBase (HWND hWnd, REFCLSID clsid, REFIID iid, void **tcServer)
{
BOOL r;
+ HRESULT hr;
if (IsUacSupported ())
{
while (true)
{
- r = CreateElevatedComObject (hWnd, clsid, iid, tcServer) == S_OK;
+ r = (hr = CreateElevatedComObject (hWnd, clsid, iid, tcServer)) == S_OK;
if (r)
break;
else
@@ -64,11 +65,16 @@ BOOL ComGetInstanceBase (HWND hWnd, REFCLSID clsid, REFIID iid, void **tcServer)
}
else
{
- r = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER, iid, tcServer) == S_OK;
+ r = (hr = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER, iid, tcServer)) == S_OK;
if (!r)
Error ("UAC_INIT_ERROR", hWnd);
}
+ if (!r)
+ {
+ SetLastError((DWORD) hr);
+ }
+
return r;
}
@@ -130,7 +136,7 @@ DWORD BaseCom::ReadWriteFile (BOOL write, BOOL device, BSTR filePath, BSTR *buff
{
try
{
- auto_ptr <File> file (device ? new Device (filePath, !write) : new File (filePath, !write));
+ unique_ptr <File> file (device ? new Device (filePath, !write) : new File (filePath, !write));
file->CheckOpened (SRC_POS);
file->SeekAt (offset);
@@ -194,7 +200,7 @@ DWORD BaseCom::DeviceIoControl (BOOL readOnly, BOOL device, BSTR filePath, DWORD
{
try
{
- auto_ptr <File> file (device ? new Device (filePath, readOnly == TRUE) : new File (filePath, readOnly == TRUE));
+ unique_ptr <File> file (device ? new Device (filePath, readOnly == TRUE) : new File (filePath, readOnly == TRUE));
file->CheckOpened (SRC_POS);
if (!file->IoCtl (dwIoControlCode, (BYTE *) input, !(BYTE *) input ? 0 : ((DWORD *) ((BYTE *) input))[-1],
(BYTE *) *output, !(BYTE *) *output ? 0 : ((DWORD *) ((BYTE *) *output))[-1]))
@@ -485,4 +491,14 @@ DWORD BaseCom::UpdateSetupConfigFile (BOOL bForInstall)
}
return ERROR_SUCCESS;
-} \ No newline at end of file
+}
+
+DWORD BaseCom::NotifyService(DWORD dwNotifyCode)
+{
+ return SendServiceNotification(dwNotifyCode);
+}
+
+DWORD BaseCom::FastFileResize (BSTR filePath, __int64 fileSize)
+{
+ return ::FastResizeFile (filePath, fileSize);
+}