|
4 | 4 | #![cfg_attr(test, allow(dead_code))] |
5 | 5 | #![unstable(issue = "0", feature = "windows_c")] |
6 | 6 |
|
| 7 | +macro_rules! ifdef { |
| 8 | + ($($t:tt)*) => ($($t)*) |
| 9 | +} |
| 10 | + |
7 | 11 | use crate::os::raw::{c_int, c_uint, c_ulong, c_long, c_longlong, c_ushort, c_char}; |
8 | 12 | use crate::ptr; |
9 | 13 |
|
@@ -655,6 +659,27 @@ pub struct timeval { |
655 | 659 | pub tv_usec: c_long, |
656 | 660 | } |
657 | 661 |
|
| 662 | +// Functions forbidden when targeting UWP |
| 663 | +#[cfg(not(target_vendor = "uwp"))] |
| 664 | +ifdef! { |
| 665 | + extern "system" { |
| 666 | + #[link_name = "SystemFunction036"] |
| 667 | + pub fn RtlGenRandom(RandomBuffer: *mut u8, RandomBufferLength: ULONG) -> BOOLEAN; |
| 668 | + } |
| 669 | +} |
| 670 | + |
| 671 | +// UWP specific functions & types |
| 672 | +#[cfg(target_vendor = "uwp")] |
| 673 | +ifdef! { |
| 674 | + pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: DWORD = 0x00000002; |
| 675 | + |
| 676 | + extern "system" { |
| 677 | + pub fn BCryptGenRandom(hAlgorithm: LPVOID, pBuffer: *mut u8, |
| 678 | + cbBuffer: ULONG, dwFlags: ULONG) -> LONG; |
| 679 | + } |
| 680 | +} |
| 681 | + |
| 682 | +// Shared between Desktop & UWP |
658 | 683 | extern "system" { |
659 | 684 | pub fn WSAStartup(wVersionRequested: WORD, |
660 | 685 | lpWSAData: LPWSADATA) -> c_int; |
@@ -950,8 +975,6 @@ extern "system" { |
950 | 975 | exceptfds: *mut fd_set, |
951 | 976 | timeout: *const timeval) -> c_int; |
952 | 977 |
|
953 | | - #[link_name = "SystemFunction036"] |
954 | | - pub fn RtlGenRandom(RandomBuffer: *mut u8, RandomBufferLength: ULONG) -> BOOLEAN; |
955 | 978 |
|
956 | 979 | pub fn GetProcessHeap() -> HANDLE; |
957 | 980 | pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID; |
|
0 commit comments