mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
link with advapi32 on windows
This commit is contained in:
parent
a9ad0cb68d
commit
e740242978
3 changed files with 8 additions and 7 deletions
|
@ -170,6 +170,7 @@ static bool os_random_buf(void* buf, size_t buf_len) {
|
|||
return (BCryptGenRandom(NULL, (PUCHAR)buf, (ULONG)buf_len, BCRYPT_USE_SYSTEM_PREFERRED_RNG) >= 0);
|
||||
}
|
||||
*/
|
||||
#pragma comment (lib,"advapi32.lib")
|
||||
#define RtlGenRandom SystemFunction036
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -181,8 +182,8 @@ BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
|
|||
static bool os_random_buf(void* buf, size_t buf_len) {
|
||||
mi_assert_internal(buf_len >= sizeof(uintptr_t));
|
||||
memset(buf, 0, buf_len);
|
||||
RtlGenRandom(buf, (ULONG)buf_len);
|
||||
return (((uintptr_t*)buf)[0] != 0); // sanity check (but RtlGenRandom should never fail)
|
||||
bool ok = (RtlGenRandom(buf, (ULONG)buf_len) != 0);
|
||||
return ok;
|
||||
}
|
||||
|
||||
#elif defined(ANDROID) || defined(XP_DARWIN) || defined(__APPLE__) || defined(__DragonFly__) || \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue