shithub: drawterm

Download patch

ref: ee260887863628ae373d9fabcddeac3b0071237a
parent: 19fc221351f4f1d159a7a5e2b6ea0d3bd2973bf3
author: aiju <devnull@localhost>
date: Tue Apr 17 06:45:42 EDT 2018

windows: RtlGenRandom cannot always be statically linked

--- a/kern/win32.c
+++ b/kern/win32.c
@@ -126,12 +126,16 @@
 	ReleaseSemaphore(op->sema, 1, 0);
 }
 
-#define RtlGenRandom	SystemFunction036
-BOOLEAN WINAPI RtlGenRandom(PVOID, ULONG);
+BOOLEAN WINAPI (*RtlGenRandom)(PVOID, ULONG);
 
 void
 randominit(void)
 {
+	HMODULE mod;
+	
+	mod = LoadLibraryW(L"ADVAPI32.DLL");
+	if(mod != NULL)
+		RtlGenRandom = (void *) GetProcAddress(mod, "SystemFunction036");
 }
 
 ulong