VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Format
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2023-07-01 22:46:01 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2023-07-01 22:46:01 +0200
commit7a3daa389cf74d7a2439d943c63a888b62abfeb9 (patch)
tree00116f5e858f7ded8ae47a0f0505430bc4ea475c /src/Format
parente28de414e0fbf1d7983c5edd3c91c83ea04fecbd (diff)
downloadVeraCrypt-7a3daa389cf74d7a2439d943c63a888b62abfeb9.tar.gz
VeraCrypt-7a3daa389cf74d7a2439d943c63a888b62abfeb9.zip
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
Diffstat (limited to 'src/Format')
-rw-r--r--src/Format/FormatCom.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Format/FormatCom.cpp b/src/Format/FormatCom.cpp
index 7c155600..147e4a15 100644
--- a/src/Format/FormatCom.cpp
+++ b/src/Format/FormatCom.cpp
@@ -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 ();