History

windows: RtlGenRandom cannot always be statically linked

aiju committed 8 years ago

Commit ee260881 parent 19fc2211 file · +6 −2Browse files

Unified · Split

kern/win32.c+6−2
@@ -126,12 +126,16 @@ procwakeup(Proc *p) · 125 unmodified lines
126126 ReleaseSemaphore(op->sema, 1, 0);
127127 }
128128
129−#define RtlGenRandom SystemFunction036
130−BOOLEAN WINAPI RtlGenRandom(PVOID, ULONG);
129+BOOLEAN WINAPI (*RtlGenRandom)(PVOID, ULONG);
131130
132131 void
133132 randominit(void)
134133 {
134+ HMODULE mod;
135+
136+ mod = LoadLibraryW(L"ADVAPI32.DLL");
137+ if(mod != NULL)
138+ RtlGenRandom = (void *) GetProcAddress(mod, "SystemFunction036");
135139 }
136140
137141 ulong

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t