@@ -287,6 +287,8 @@ pub const STACK_SIZE_PARAM_IS_A_RESERVATION: DWORD = 0x00010000;
287287
288288pub const STATUS_SUCCESS : NTSTATUS = 0x00000000 ;
289289
290+ pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG : DWORD = 0x00000002 ;
291+
290292#[ repr( C ) ]
291293#[ cfg( not( target_pointer_width = "64" ) ) ]
292294pub struct WSADATA {
@@ -687,9 +689,6 @@ if #[cfg(not(target_vendor = "uwp"))] {
687689 pub const TOKEN_READ : DWORD = 0x20008 ;
688690
689691 extern "system" {
690- #[ link_name = "SystemFunction036" ]
691- pub fn RtlGenRandom ( RandomBuffer : * mut u8 , RandomBufferLength : ULONG ) -> BOOLEAN ;
692-
693692 pub fn ReadConsoleW ( hConsoleInput: HANDLE ,
694693 lpBuffer: LPVOID ,
695694 nNumberOfCharsToRead: DWORD ,
@@ -731,8 +730,6 @@ if #[cfg(not(target_vendor = "uwp"))] {
731730// UWP specific functions & types
732731cfg_if:: cfg_if! {
733732if #[ cfg( target_vendor = "uwp" ) ] {
734- pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG : DWORD = 0x00000002 ;
735-
736733 #[ repr( C ) ]
737734 pub struct FILE_STANDARD_INFO {
738735 pub AllocationSize : LARGE_INTEGER ,
@@ -747,8 +744,6 @@ if #[cfg(target_vendor = "uwp")] {
747744 fileInfoClass: FILE_INFO_BY_HANDLE_CLASS ,
748745 lpFileInformation: LPVOID ,
749746 dwBufferSize: DWORD ) -> BOOL ;
750- pub fn BCryptGenRandom ( hAlgorithm: LPVOID , pBuffer: * mut u8 ,
751- cbBuffer: ULONG , dwFlags: ULONG ) -> LONG ;
752747 }
753748}
754749}
@@ -1068,6 +1063,15 @@ extern "system" {
10681063 pub fn ReleaseSRWLockShared ( SRWLock : PSRWLOCK ) ;
10691064 pub fn TryAcquireSRWLockExclusive ( SRWLock : PSRWLOCK ) -> BOOLEAN ;
10701065 pub fn TryAcquireSRWLockShared ( SRWLock : PSRWLOCK ) -> BOOLEAN ;
1066+
1067+ // >= Vista / Server 2008
1068+ // https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom
1069+ pub fn BCryptGenRandom (
1070+ hAlgorithm : LPVOID ,
1071+ pBuffer : * mut u8 ,
1072+ cbBuffer : ULONG ,
1073+ dwFlags : ULONG ,
1074+ ) -> NTSTATUS ;
10711075}
10721076
10731077// Functions that aren't available on every version of Windows that we support,
0 commit comments