From 724043be0b9ed68382c49c54b4750ddeaebe81c4 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 5 Jul 2015 18:15:41 +0200 Subject: Windows: Display source location of errors in order to help diagnose issues reported by users --- src/ExpandVolume/DlgExpandVolume.cpp | 6 +++--- src/ExpandVolume/ExpandVolume.c | 6 +++++- src/ExpandVolume/InitDataArea.c | 8 ++++++-- src/ExpandVolume/WinMain.cpp | 4 ++-- 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'src/ExpandVolume') diff --git a/src/ExpandVolume/DlgExpandVolume.cpp b/src/ExpandVolume/DlgExpandVolume.cpp index 554f4f6f..15888f50 100644 --- a/src/ExpandVolume/DlgExpandVolume.cpp +++ b/src/ExpandVolume/DlgExpandVolume.cpp @@ -385,7 +385,7 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L pProgressDlgParam->hwndDlg = hwndDlg; if ( _beginthread (volTransformThreadFunction, 0, pProgressDlgParam) == -1L ) { - handleError (hwndDlg, ERR_OS_ERROR); + handleError (hwndDlg, ERR_OS_ERROR, SRC_POS); EndDialog (hwndDlg, lw); } WaitCursor(); @@ -572,7 +572,7 @@ void ExpandVolumeWizard (HWND hwndDlg, char *lpszVolume) NormalCursor(); - handleError (hwndDlg, nStatus); + handleError (hwndDlg, nStatus, SRC_POS); } WaitCursor(); @@ -722,7 +722,7 @@ ret: error: if (nStatus != 0) - handleError (hwndDlg, nStatus); + handleError (hwndDlg, nStatus, SRC_POS); burn (&VolumePassword, sizeof (VolumePassword)); diff --git a/src/ExpandVolume/ExpandVolume.c b/src/ExpandVolume/ExpandVolume.c index 5b9509be..9233340c 100644 --- a/src/ExpandVolume/ExpandVolume.c +++ b/src/ExpandVolume/ExpandVolume.c @@ -56,6 +56,10 @@ Original legal notice of the TrueCrypt source files: #include "ExpandVolume.h" #include "Resource.h" +#ifndef SRC_POS +#define SRC_POS (__FUNCTION__ ":" TC_TO_STRING(__LINE__)) +#endif + #define DEBUG_EXPAND_VOLUME #ifdef DEBUG_EXPAND_VOLUME @@ -987,7 +991,7 @@ void __cdecl volTransformThreadFunction (void *pExpandDlgParam) pParam->VolumePkcs5, pParam->VolumePin, pParam->newSize, pParam->bInitFreeSpace ); if (nStatus!=ERR_SUCCESS && nStatus!=ERR_USER_ABORT) - handleError (hwndDlg, nStatus); + handleError (hwndDlg, nStatus, SRC_POS); bVolTransformThreadCancel = FALSE; diff --git a/src/ExpandVolume/InitDataArea.c b/src/ExpandVolume/InitDataArea.c index a3793e86..c1eb6bd2 100644 --- a/src/ExpandVolume/InitDataArea.c +++ b/src/ExpandVolume/InitDataArea.c @@ -59,6 +59,10 @@ Original legal notice of the TrueCrypt source: #include "InitDataArea.h" +#ifndef SRC_POS +#define SRC_POS (__FUNCTION__ ":" TC_TO_STRING(__LINE__)) +#endif + int FormatWriteBufferSize = 1024 * 1024; static uint32 FormatSectorSize = 0; @@ -226,7 +230,7 @@ static void __cdecl FormatWriteThreadProc (void *arg) { if (WaitForSingleObject (WriteBufferFullEvent, INFINITE) == WAIT_FAILED) { - handleWin32Error (NULL); + handleWin32Error (NULL, SRC_POS); break; } @@ -240,7 +244,7 @@ static void __cdecl FormatWriteThreadProc (void *arg) if (!SetEvent (WriteBufferEmptyEvent)) { - handleWin32Error (NULL); + handleWin32Error (NULL, SRC_POS); break; } } diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp index 81d782c1..020a6b22 100644 --- a/src/ExpandVolume/WinMain.cpp +++ b/src/ExpandVolume/WinMain.cpp @@ -983,9 +983,9 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, char *lpszComm 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"); } -- cgit v1.2.3