mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 19:08:26 -06:00
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).
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user