shithub: drawterm

Download patch

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

windows: RtlGenRandom cannot always be statically linked

--- a/kern/win32.c	Tue Apr 17 05:45:25 2018
+++ b/kern/win32.c	Tue Apr 17 05:45:42 2018
@@ -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