diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-01-31 23:49:01 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-02-08 10:07:44 +0100 |
commit | 96b39a5973d354bf759fefc13e551fb75e1c25c7 (patch) | |
tree | eff49cc60f967517f998418dfc06a7ce0b7cae0d /src/Common/BaseCom.cpp | |
parent | b16cfa959da8836028a74194ce4f1d33a1dbef46 (diff) | |
download | VeraCrypt-96b39a5973d354bf759fefc13e551fb75e1c25c7.tar.gz VeraCrypt-96b39a5973d354bf759fefc13e551fb75e1c25c7.zip |
Windows: retry UAC prompt operation in case of failure. This avoids cancel the whole operation if the user is not in front of the machine during UAC prompt (this happens ofter during in-place encryption of big NTFS partitions).
Diffstat (limited to 'src/Common/BaseCom.cpp')
-rw-r--r-- | src/Common/BaseCom.cpp | 23 |
1 files changed, 19 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;
}
|