1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2026-05-21 21:30:48 -05:00

Windows: Make API formatting fallback to format.com in case of elevation. remove dead code from ExternalFormatFs

We also modify UacFormatNtfs/UacFormatFs to return actual error code in case of failure
This commit is contained in:
Mounir IDRASSI
2023-07-01 22:46:01 +02:00
parent e28de414e0
commit 7a3daa389c
3 changed files with 24 additions and 57 deletions
+8 -2
View File
@@ -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;
}