@@ -287,6 +287,8 @@ pub const STACK_SIZE_PARAM_IS_A_RESERVATION: DWORD = 0x00010000;
287
287
288
288
pub const STATUS_SUCCESS : NTSTATUS = 0x00000000 ;
289
289
290
+ pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG : DWORD = 0x00000002 ;
291
+
290
292
#[ repr( C ) ]
291
293
#[ cfg( not( target_pointer_width = "64" ) ) ]
292
294
pub struct WSADATA {
@@ -687,9 +689,6 @@ if #[cfg(not(target_vendor = "uwp"))] {
687
689
pub const TOKEN_READ : DWORD = 0x20008 ;
688
690
689
691
extern "system" {
690
- #[ link_name = "SystemFunction036" ]
691
- pub fn RtlGenRandom ( RandomBuffer : * mut u8 , RandomBufferLength : ULONG ) -> BOOLEAN ;
692
-
693
692
pub fn ReadConsoleW ( hConsoleInput: HANDLE ,
694
693
lpBuffer: LPVOID ,
695
694
nNumberOfCharsToRead: DWORD ,
@@ -731,8 +730,6 @@ if #[cfg(not(target_vendor = "uwp"))] {
731
730
// UWP specific functions & types
732
731
cfg_if:: cfg_if! {
733
732
if #[ cfg( target_vendor = "uwp" ) ] {
734
- pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG : DWORD = 0x00000002 ;
735
-
736
733
#[ repr( C ) ]
737
734
pub struct FILE_STANDARD_INFO {
738
735
pub AllocationSize : LARGE_INTEGER ,
@@ -747,8 +744,6 @@ if #[cfg(target_vendor = "uwp")] {
747
744
fileInfoClass: FILE_INFO_BY_HANDLE_CLASS ,
748
745
lpFileInformation: LPVOID ,
749
746
dwBufferSize: DWORD ) -> BOOL ;
750
- pub fn BCryptGenRandom ( hAlgorithm: LPVOID , pBuffer: * mut u8 ,
751
- cbBuffer: ULONG , dwFlags: ULONG ) -> LONG ;
752
747
}
753
748
}
754
749
}
@@ -1068,6 +1063,15 @@ extern "system" {
1068
1063
pub fn ReleaseSRWLockShared ( SRWLock : PSRWLOCK ) ;
1069
1064
pub fn TryAcquireSRWLockExclusive ( SRWLock : PSRWLOCK ) -> BOOLEAN ;
1070
1065
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 ;
1071
1075
}
1072
1076
1073
1077
// Functions that aren't available on every version of Windows that we support,
0 commit comments