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/Common/Dlgcode.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Common/Dlgcode.h') diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index f6b285c4..1d0db30c 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -237,7 +237,7 @@ void AbortProcess ( char *stringId ); void AbortProcessSilent ( void ); void *err_malloc ( size_t size ); char *err_strdup ( char *lpszText ); -DWORD handleWin32Error ( HWND hwndDlg ); +DWORD handleWin32Error ( HWND hwndDlg, const char* srcPos ); BOOL IsDiskReadError (DWORD error); BOOL IsDiskWriteError (DWORD error); BOOL IsDiskError (DWORD error); @@ -317,7 +317,7 @@ void ResetCipherTest ( HWND hwndDlg , int idTestCipher ); void ResetCurrentDirectory (); BOOL BrowseFiles (HWND hwndDlg, char *stringId, char *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter); BOOL BrowseDirectories (HWND hWnd, char *lpszTitle, char *dirName); -void handleError ( HWND hwndDlg , int code ); +void handleError ( HWND hwndDlg , int code, const char* srcPos ); BOOL CheckFileStreamWriteErrors (HWND hwndDlg, FILE *file, const char *fileName); void LocalizeDialog ( HWND hwnd, char *stringId ); void OpenVolumeExplorerWindow (int driveNo); @@ -552,6 +552,10 @@ std::string FindLatestFileOrDirectory (const std::string &directory, const char std::string GetUserFriendlyVersionString (int version); std::string IntToString (int val); std::wstring IntToWideString (int val); +inline std::wstring AppendSrcPos (const wchar_t* msg, const char* srcPos) +{ + return std::wstring (msg) + L"\n\nSource: " + SingleStringToWide (srcPos); +} // Display a wait dialog while calling the provided callback with the given parameter typedef void (CALLBACK* WaitThreadProc)(void* pArg, HWND hWaitDlg); -- cgit v1.2.3