From f341129afa4ed68323b730ec53df189d271781eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Fri, 22 Apr 2022 18:31:49 +0300 Subject: [PATCH] mdbx-windows: fix for non-x86 with `MDBX_WITHOUT_MSVC_CRT=ON` and `MDBX_BUILD_SHARED_LIBRARY=ON`. --- src/osal.c | 3 +++ src/osal.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/osal.c b/src/osal.c index 4dc6861c..d19c3d36 100644 --- a/src/osal.c +++ b/src/osal.c @@ -1945,6 +1945,9 @@ __cold MDBX_INTERNAL_FUNC void mdbx_osal_jitter(bool tiny) { #if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || \ defined(__x86_64__) const unsigned salt = 277u * (unsigned)__rdtsc(); +#elif (defined(_WIN32) || defined(_WIN64)) && MDBX_WITHOUT_MSVC_CRT + static ULONG state; + const unsigned salt = (unsigned)RtlRandomEx(&state); #else const unsigned salt = rand(); #endif diff --git a/src/osal.h b/src/osal.h index 31a5d1a7..6a7992bb 100644 --- a/src/osal.h +++ b/src/osal.h @@ -991,6 +991,8 @@ typedef LSTATUS(WINAPI *MDBX_RegGetValueA)(HKEY hkey, LPCSTR lpSubKey, LPDWORD pcbData); MDBX_INTERNAL_VAR MDBX_RegGetValueA mdbx_RegGetValueA; +NTSYSAPI ULONG RtlRandomEx(PULONG Seed); + #endif /* Windows */ #endif /* !__cplusplus */