renpy/module/libhydrogen/impl/random/windows.h

21 lines
503 B
C
Raw Normal View History

2023-09-12 22:16:10 +00:00
#include <windows.h>
#define RtlGenRandom SystemFunction036
#if defined(__cplusplus)
extern "C"
#endif
BOOLEAN NTAPI
RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
#pragma comment(lib, "advapi32.lib")
static int
hydro_random_init(void)
{
if (!RtlGenRandom((PVOID) hydro_random_context.state,
(ULONG) sizeof hydro_random_context.state)) {
return -1;
}
hydro_random_context.counter = ~LOAD64_LE(hydro_random_context.state);
return 0;
}