1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06: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

View File

@@ -92,7 +92,7 @@ public:
virtual BOOL STDMETHODCALLTYPE FormatNtfs (int driveNo, int clusterSize)
{
return ::FormatNtfs (driveNo, clusterSize);
return ::FormatNtfs (driveNo, clusterSize, TRUE);
}
virtual int STDMETHODCALLTYPE AnalyzeHiddenVolumeHost (
@@ -134,7 +134,7 @@ public:
virtual BOOL STDMETHODCALLTYPE FormatFs (int driveNo, int clusterSize, int fsType)
{
return ::FormatFs (driveNo, clusterSize, fsType);
return ::FormatFs (driveNo, clusterSize, fsType, TRUE);
}
virtual DWORD STDMETHODCALLTYPE GetFileSize (BSTR filePath, unsigned __int64 *pSize)
@@ -250,7 +250,7 @@ extern "C" int UacFormatNtfs (HWND hWnd, int driveNo, int clusterSize)
if (ComGetInstance (hWnd, &tc))
r = tc->FormatNtfs (driveNo, clusterSize);
else
r = 0;
r = (int) GetLastError();
CoUninitialize ();
@@ -267,7 +267,7 @@ extern "C" int UacFormatFs (HWND hWnd, int driveNo, int clusterSize, int fsType)
if (ComGetInstance (hWnd, &tc))
r = tc->FormatFs (driveNo, clusterSize, fsType);
else
r = 0;
r = (int) GetLastError();
CoUninitialize ();