diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-07-05 18:15:41 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-07-06 01:19:21 +0200 |
commit | 724043be0b9ed68382c49c54b4750ddeaebe81c4 (patch) | |
tree | f93ab6d2b1597b9fd2c3c354f0c730b805cc3c57 /src/Common/Random.c | |
parent | c3b77fba25539c433c882d980169f2c68329e996 (diff) | |
download | VeraCrypt-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/Common/Random.c')
-rw-r--r-- | src/Common/Random.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Common/Random.c b/src/Common/Random.c index c1479340..1a0637ba 100644 --- a/src/Common/Random.c +++ b/src/Common/Random.c @@ -66,6 +66,10 @@ void RandAddInt64 (unsigned __int64 x) #include <tlhelp32.h>
#include "Dlgcode.h"
+#ifndef SRC_POS
+#define SRC_POS (__FUNCTION__ ":" TC_TO_STRING(__LINE__))
+#endif
+
HHOOK hMouse = NULL; /* Mouse hook for the random number generator */
HHOOK hKeyboard = NULL; /* Keyboard hook for the random number generator */
@@ -112,12 +116,12 @@ int Randinit () }
hKeyboard = SetWindowsHookEx (WH_KEYBOARD, (HOOKPROC)&KeyboardProc, NULL, GetCurrentThreadId ());
- if (hKeyboard == 0) handleWin32Error (0);
+ if (hKeyboard == 0) handleWin32Error (0, SRC_POS);
hMouse = SetWindowsHookEx (WH_MOUSE, (HOOKPROC)&MouseProc, NULL, GetCurrentThreadId ());
if (hMouse == 0)
{
- handleWin32Error (0);
+ handleWin32Error (0, SRC_POS);
goto error;
}
@@ -388,7 +392,7 @@ BOOL RandgetBytesFull ( void* hwndDlg, unsigned char *buf , int len, BOOL forceS {
if (!SlowPoll ())
{
- handleError ((HWND) hwndDlg, ERR_CAPI_INIT_FAILED);
+ handleError ((HWND) hwndDlg, ERR_CAPI_INIT_FAILED, SRC_POS);
ret = FALSE;
}
else
@@ -397,7 +401,7 @@ BOOL RandgetBytesFull ( void* hwndDlg, unsigned char *buf , int len, BOOL forceS if (!FastPoll ())
{
- handleError ((HWND) hwndDlg, ERR_CAPI_INIT_FAILED);
+ handleError ((HWND) hwndDlg, ERR_CAPI_INIT_FAILED, SRC_POS);
ret = FALSE;
}
|