diff options
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 @@ -65,8 +65,12 @@ 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 */
/* Variables for thread control, the thread is used to gather up info about
@@ -111,14 +115,14 @@ int Randinit () VirtualLock (pRandPool, RANDOMPOOL_ALLOCSIZE);
}
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;
}
if (!CryptAcquireContext (&hCryptProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
@@ -387,18 +391,18 @@ BOOL RandgetBytesFull ( void* hwndDlg, unsigned char *buf , int len, BOOL forceS if (bDidSlowPoll == FALSE || forceSlowPoll)
{
if (!SlowPoll ())
{
- handleError ((HWND) hwndDlg, ERR_CAPI_INIT_FAILED);
+ handleError ((HWND) hwndDlg, ERR_CAPI_INIT_FAILED, SRC_POS);
ret = FALSE;
}
else
bDidSlowPoll = TRUE;
}
if (!FastPoll ())
{
- handleError ((HWND) hwndDlg, ERR_CAPI_INIT_FAILED);
+ handleError ((HWND) hwndDlg, ERR_CAPI_INIT_FAILED, SRC_POS);
ret = FALSE;
}
/* There's never more than RNG_POOL_SIZE worth of randomess */
|