mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-30 14:25:36 +08:00
remove RtlGenRandom and use the newer BCryptGenRandom
This commit is contained in:
parent
a841f43f4b
commit
3afde6e996
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,7 +11,6 @@ release/*
|
||||
/dll/net.pb.h
|
||||
base.exp
|
||||
base.lib
|
||||
rtlgenrandom*
|
||||
steamclient.exp
|
||||
steamclient.lib
|
||||
out/*
|
||||
|
@ -22,8 +22,9 @@
|
||||
static void
|
||||
randombytes(char * const buf, const size_t size)
|
||||
{
|
||||
while (!RtlGenRandom((PVOID) buf, (ULONG) size)) {
|
||||
PRINT_DEBUG("RtlGenRandom ERROR\n");
|
||||
// NT_SUCCESS is: return value >= 0, including Ntdef.h causes so many errors
|
||||
while (BCryptGenRandom(NULL, (PUCHAR) buf, (ULONG) size, BCRYPT_USE_SYSTEM_PREFERRED_RNG) < 0) {
|
||||
PRINT_DEBUG("BCryptGenRandom ERROR\n");
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
|
@ -61,9 +61,7 @@
|
||||
|
||||
#define MSG_NOSIGNAL 0
|
||||
|
||||
#define SystemFunction036 NTAPI SystemFunction036
|
||||
#include <ntsecapi.h>
|
||||
#undef SystemFunction036
|
||||
#include <bcrypt.h>
|
||||
|
||||
#ifndef EMU_RELEASE_BUILD
|
||||
#define PRINT_DEBUG(a, ...) do {FILE *t = fopen("STEAM_LOG.txt", "a"); fprintf(t, "%u " a, GetCurrentThreadId(), __VA_ARGS__); fclose(t); WSASetLastError(0);} while (0)
|
||||
|
@ -1,4 +0,0 @@
|
||||
#include <windows.h>
|
||||
#define RtlGenRandom SystemFunction036
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
DLLEXPORT BOOLEAN WINAPI RtlGenRandom(PVOID in, ULONG len) {}
|
@ -1,3 +0,0 @@
|
||||
LIBRARY advapi32.dll
|
||||
EXPORTS
|
||||
SystemFunction036
|
Loading…
Reference in New Issue
Block a user