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/Random.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/Common/Random.c') 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 #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; } -- cgit v1.2.3