diff --git a/std/os/index.zig b/std/os/index.zig index b5e0129da..425a900a7 100644 --- a/std/os/index.zig +++ b/std/os/index.zig @@ -133,7 +133,7 @@ pub fn getRandomBytes(buf: []u8) !void { // Call RtlGenRandom() instead of CryptGetRandom() on Windows // https://github.com/rust-lang-nursery/rand/issues/111 // https://bugzilla.mozilla.org/show_bug.cgi?id=504270 - if (!windows.RtlGenRandom(buf.ptr, buf.len)) { + if (windows.RtlGenRandom(buf.ptr, buf.len) == 0) { const err = windows.GetLastError(); return switch (err) { else => unexpectedErrorWindows(err), diff --git a/std/os/windows/advapi32.zig b/std/os/windows/advapi32.zig index 64a820a3b..2f3195475 100644 --- a/std/os/windows/advapi32.zig +++ b/std/os/windows/advapi32.zig @@ -31,5 +31,5 @@ pub extern "advapi32" stdcallcc fn RegQueryValueExW(hKey: HKEY, lpValueName: LPC // RtlGenRandom is known as SystemFunction036 under advapi32 // http://msdn.microsoft.com/en-us/library/windows/desktop/aa387694.aspx */ -pub extern "advapi32" stdcallcc fn SystemFunction036(output: PVOID, length: ULONG_PTR) BOOL; +pub extern "advapi32" stdcallcc fn SystemFunction036(output: [*]u8, length: usize) BOOL; pub const RtlGenRandom = SystemFunction036;