VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Format/Tcformat.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-07-05 18:15:41 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-07-06 01:19:21 +0200
commit724043be0b9ed68382c49c54b4750ddeaebe81c4 (patch)
treef93ab6d2b1597b9fd2c3c354f0c730b805cc3c57 /src/Format/Tcformat.c
parentc3b77fba25539c433c882d980169f2c68329e996 (diff)
downloadVeraCrypt-724043be0b9ed68382c49c54b4750ddeaebe81c4.tar.gz
VeraCrypt-724043be0b9ed68382c49c54b4750ddeaebe81c4.zip
Windows: Display source location of errors in order to help diagnose issues reported by users
Diffstat (limited to 'src/Format/Tcformat.c')
-rw-r--r--src/Format/Tcformat.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index bee1e028..523c069b 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -307,9 +307,9 @@ void CALLBACK ResumeInPlaceEncWaitThreadProc(void* pArg, HWND hwndDlg)
CloseVolume (&volume);
}
else
{
- handleError(hwndDlg, status);
+ handleError(hwndDlg, status, SRC_POS);
}
break;
}
@@ -523,9 +523,9 @@ static BOOL SaveSysEncSettings (HWND hwndDlg)
f = fopen (GetConfigPath (TC_APPD_FILENAME_SYSTEM_ENCRYPTION), "w");
if (f == NULL)
{
Error ("CANNOT_SAVE_SYS_ENCRYPTION_SETTINGS", hwndDlg);
- handleWin32Error (hwndDlg);
+ handleWin32Error (hwndDlg, SRC_POS);
return FALSE;
}
if (XmlWriteHeader (f) < 0
@@ -539,9 +539,9 @@ static BOOL SaveSysEncSettings (HWND hwndDlg)
|| fputs ("\n\t</sysencryption>", f) < 0
|| XmlWriteFooter (f) < 0)
{
- handleWin32Error (hwndDlg);
+ handleWin32Error (hwndDlg, SRC_POS);
fclose (f);
Error ("CANNOT_SAVE_SYS_ENCRYPTION_SETTINGS", hwndDlg);
return FALSE;
}
@@ -2661,9 +2661,9 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg)
/* An error occurred */
wchar_t szMsg[8192];
- handleError (hwndDlg, nStatus);
+ handleError (hwndDlg, nStatus, SRC_POS);
if (bInPlaceEncNonSys)
{
if (bInPlaceEncNonSysResumed)
@@ -3291,9 +3291,9 @@ BOOL QueryFreeSpace (HWND hwndDlg, HWND hwndTextBox, BOOL display)
ULARGE_INTEGER free;
if (!GetVolumePathName (szFileName, root, sizeof (root)))
{
- handleWin32Error (hwndDlg);
+ handleWin32Error (hwndDlg, SRC_POS);
return FALSE;
}
if (!GetDiskFreeSpaceEx (root, &free, 0, 0))
@@ -5225,9 +5225,9 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
nVolumeSize = GetDeviceSize (szDiskFile);
if (nVolumeSize == -1)
{
- handleWin32Error (MainDlg);
+ handleWin32Error (MainDlg, SRC_POS);
return 1;
}
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), TRUE);
@@ -5845,9 +5845,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
InitDialog (hwndDlg);
if (!ComServerFormat ())
{
- handleWin32Error (hwndDlg);
+ handleWin32Error (hwndDlg, SRC_POS);
exit (1);
}
exit (0);
}
@@ -6992,9 +6992,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
nVolumeSize = GetDeviceSize (szDiskFile);
if (nVolumeSize == -1)
{
- handleWin32Error (MainDlg);
+ handleWin32Error (MainDlg, SRC_POS);
return 1;
}
if (AskWarnYesNo ("NONSYS_INPLACE_ENC_CONFIRM_BACKUP", hwndDlg) == IDNO)
@@ -7352,9 +7352,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
nVolumeSize = GetDeviceSize (szDiskFile);
if (nVolumeSize == -1)
{
- handleWin32Error (MainDlg);
+ handleWin32Error (MainDlg, SRC_POS);
NormalCursor();
return 1;
}
@@ -7379,9 +7379,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (driveNo == -1
|| !UnmountVolume (hwndDlg, driveNo, TRUE))
{
- handleWin32Error (MainDlg);
+ handleWin32Error (MainDlg, SRC_POS);
AbortProcess ("CANT_DISMOUNT_VOLUME");
}
}
@@ -7412,9 +7412,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
memset (&volProp, 0, sizeof(volProp));
volProp.driveNo = driveNo;
if (!DeviceIoControl (hDriver, TC_IOCTL_GET_VOLUME_PROPERTIES, &volProp, sizeof (volProp), &volProp, sizeof (volProp), &dwResult, NULL) || dwResult == 0)
{
- handleWin32Error (hwndDlg);
+ handleWin32Error (hwndDlg, SRC_POS);
UnmountVolume (hwndDlg, driveNo, TRUE);
AbortProcess ("CANT_GET_VOL_INFO");
}
@@ -7434,9 +7434,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
// Remount the volume using the backup header to verify it is working
if (!UnmountVolume (hwndDlg, driveNo, TRUE))
{
- handleWin32Error (MainDlg);
+ handleWin32Error (MainDlg, SRC_POS);
AbortProcess ("CANT_DISMOUNT_VOLUME");
}
mountOptions.UseBackupHeader = TRUE; // This must be TRUE at this point (we won't be using the regular header, which will be lost soon after the decryption process starts)
@@ -7448,9 +7448,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
if (!UnmountVolume (hwndDlg, driveNo, TRUE))
{
- handleWin32Error (MainDlg);
+ handleWin32Error (MainDlg, SRC_POS);
AbortProcess ("CANT_DISMOUNT_VOLUME");
}
BOOL tmpbDevice;
@@ -7459,9 +7459,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
nVolumeSize = GetDeviceSize (szDiskFile);
if (nVolumeSize == -1)
{
- handleWin32Error (MainDlg);
+ handleWin32Error (MainDlg, SRC_POS);
AbortProcessSilent ();
}
nNewPageNo = NONSYS_INPLACE_ENC_TRANSFORM_PAGE - 1; // Skip irrelevant pages
@@ -8744,9 +8744,9 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi
memset (&volProp, 0, sizeof(volProp));
volProp.driveNo = *driveNo;
if (!DeviceIoControl (hDriver, TC_IOCTL_GET_VOLUME_PROPERTIES, &volProp, sizeof (volProp), &volProp, sizeof (volProp), &dwResult, NULL) || dwResult == 0)
{
- handleWin32Error (hwndDlg);
+ handleWin32Error (hwndDlg, SRC_POS);
Error ("CANT_ACCESS_OUTER_VOL", hwndDlg);
goto efsf_error;
}
@@ -8782,17 +8782,17 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi
offset.QuadPart = 0;
if (SetFilePointerEx (hDevice, offset, &offsetNew, FILE_BEGIN) == 0)
{
- handleWin32Error (hwndDlg);
+ handleWin32Error (hwndDlg, SRC_POS);
goto efs_error;
}
result = ReadFile (hDevice, &readBuffer, TC_MAX_VOLUME_SECTOR_SIZE, &bytesReturned, NULL);
if (result == 0)
{
- handleWin32Error (hwndDlg);
+ handleWin32Error (hwndDlg, SRC_POS);
MessageBoxW (hwndDlg, GetString ("CANT_ACCESS_OUTER_VOL"), lpszTitle, ICON_HAND);
goto efs_error;
}
@@ -8841,9 +8841,9 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi
&dwBytesPerSector,
&dwNumberOfFreeClusters,
&dwTotalNumberOfClusters))
{
- handleWin32Error (hwndDlg);
+ handleWin32Error (hwndDlg, SRC_POS);
Error ("CANT_GET_OUTER_VOL_INFO", hwndDlg);
return -1;
};
@@ -8954,9 +8954,9 @@ int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int
bufLen,
&lBytesReturned,
NULL))
{
- handleWin32Error (hwndDlg);
+ handleWin32Error (hwndDlg, SRC_POS);
MessageBoxW (hwndDlg, GetString ("CANT_GET_CLUSTER_BITMAP"), lpszTitle, ICON_HAND);
goto vcm_error;
}
@@ -9648,11 +9648,11 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, char *lpszComm
status = DriverAttach ();
if (status != 0)
{
if (status == ERR_OS_ERROR)
- handleWin32Error (NULL);
+ handleWin32Error (NULL, SRC_POS);
else
- handleError (NULL, status);
+ handleError (NULL, status, SRC_POS);
AbortProcess ("NODRIVER");
}
@@ -9676,9 +9676,9 @@ static int GetFormatSectorSize ()
DISK_GEOMETRY geometry;
if (!GetDriveGeometry (szDiskFile, &geometry))
{
- handleWin32Error (MainDlg);
+ handleWin32Error (MainDlg, SRC_POS);
AbortProcessSilent();
}
return geometry.BytesPerSector;