VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/BaseCom.cpp23
-rw-r--r--src/Common/Dlgcode.c5
-rw-r--r--src/Common/Dlgcode.h1
3 files changed, 25 insertions, 4 deletions
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp
index 349edabc..9a0c26f7 100644
--- a/src/Common/BaseCom.cpp
+++ b/src/Common/BaseCom.cpp
@@ -43,12 +43,27 @@ BOOL ComGetInstanceBase (HWND hWnd, REFCLSID clsid, REFIID iid, void **tcServer)
BOOL r;
if (IsUacSupported ())
- r = CreateElevatedComObject (hWnd, clsid, iid, tcServer) == S_OK;
+ {
+ while (true)
+ {
+ r = CreateElevatedComObject (hWnd, clsid, iid, tcServer) == S_OK;
+ if (r)
+ break;
+ else
+ {
+ if (IDRETRY == ErrorRetryCancel ("UAC_INIT_ERROR", hWnd))
+ continue;
+ else
+ break;
+ }
+ }
+ }
else
+ {
r = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER, iid, tcServer) == S_OK;
-
- if (!r)
- Error ("UAC_INIT_ERROR", hWnd);
+ if (!r)
+ Error ("UAC_INIT_ERROR", hWnd);
+ }
return r;
}
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index a6354fd2..d4f68134 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -8089,6 +8089,11 @@ int Error (char *stringId, HWND hwnd)
return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONERROR);
}
+int ErrorRetryCancel (char *stringId, HWND hwnd)
+{
+ if (Silent) return 0;
+ return MessageBoxW (hwnd, GetString (stringId), lpszTitle, MB_ICONERROR | MB_RETRYCANCEL);
+}
int ErrorTopMost (char *stringId, HWND hwnd)
{
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 601871ce..4b371c05 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -385,6 +385,7 @@ int Warning (char *stringId, HWND hwnd);
int WarningTopMost (char *stringId, HWND hwnd);
int WarningDirect (const wchar_t *warnMsg, HWND hwnd);
int Error (char *stringId, HWND hwnd);
+int ErrorRetryCancel (char *stringId, HWND hwnd);
int ErrorDirect (const wchar_t *errMsg, HWND hwnd);
int ErrorTopMost (char *stringId, HWND hwnd);
int AskYesNo (char *stringId, HWND hwnd);