windows: use ProcessPrng from bcryptprimitives.dll

rather than SystemFunction036 from advapi32. This has the advantage that
the code is loaded preemptively, preventing random numbers from
failing when they are needed for the first time on a system under heavy
load.
This commit is contained in:
Andrew Kelley
2026-01-05 00:36:11 -08:00
parent 36044a0e81
commit 60e2ea0bfb
7 changed files with 6 additions and 36 deletions
-1
View File
@@ -32,7 +32,6 @@ pub fn build(b: *std.Build) void {
}),
});
exe.subsystem = .console;
exe.root_module.linkSystemLibrary("advapi32", .{}); // for RtlGenRandom
exe.root_module.linkSystemLibrary("kernel32", .{});
exe.root_module.linkSystemLibrary("ntdll", .{});
exe.root_module.addObject(obj);
@@ -12,7 +12,6 @@ pub fn build(b: *std.Build) void {
test_obj.root_module.linkSystemLibrary("ntdll", .{});
test_obj.root_module.linkSystemLibrary("kernel32", .{});
test_obj.root_module.linkSystemLibrary("ws2_32", .{});
test_obj.root_module.linkSystemLibrary("advapi32", .{}); // for RtlGenRandom
}
const test_exe_mod = b.createModule(.{
-1
View File
@@ -86,7 +86,6 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize,
}),
});
lib_msvc.root_module.linkSystemLibrary("advapi32", .{}); // for RtlGenRandom
const verify_msvc = b.addExecutable(.{
.name = "verify-msvc",
.root_module = b.createModule(.{