Skip to content
Closed
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4c05e3a
Use `raw-dylib` in the std
ChrisDenton Sep 10, 2022
ba847ca
Enable varargs support for calling conventions other than C or cdecl
Soveu Aug 8, 2022
65ef625
Apply suggestions from code review
jackh726 Aug 16, 2022
de78c32
Cleanup message and bless tests
jackh726 Oct 23, 2022
ac732b6
rustdoc: clean up `#toggle-all-docs`
notriddle Sep 17, 2022
bdbc977
rustdoc: fix weird toggle-all-docs style in iOS
notriddle Sep 17, 2022
0c4a01a
check lld version to choose correct flag for tests
belovdv Sep 21, 2022
c4c4c56
Replace `mir_map.0` dump with `built` phase change dump
JakobDegen Sep 5, 2022
51b0363
Move mir building mir-opt tests to own directory
JakobDegen Oct 27, 2022
3195388
rustdoc: add support for incoherent impls on structs and traits
notriddle Oct 29, 2022
eb2dd95
Add regression test for reexports in search results
GuillaumeGomez Oct 30, 2022
8609364
All verbosity checks in `PrettyPrinter` now go through `PrettyPrinter…
SarthakSingh31 Oct 30, 2022
a227543
Rollup merge of #97971 - Soveu:varargs, r=jackh726
notriddle Oct 30, 2022
5965158
Rollup merge of #101428 - JakobDegen:build-tests, r=oli-obk
notriddle Oct 30, 2022
a0e9c70
Rollup merge of #101944 - notriddle:notriddle/toggle-all-docs, r=jsha…
notriddle Oct 30, 2022
c0ee7a1
Rollup merge of #102101 - BelovDV:new-check-lld-version, r=petrochenkov
notriddle Oct 30, 2022
d70f59d
Rollup merge of #102327 - ChrisDenton:std-raw-dylib, r=thomcc
notriddle Oct 30, 2022
b544523
Rollup merge of #103746 - notriddle:notriddle/incoherent-dyn-trait, r…
notriddle Oct 30, 2022
7080630
Rollup merge of #103758 - GuillaumeGomez:reexports-search-result-test…
notriddle Oct 30, 2022
b46dd7c
Rollup merge of #103764 - SarthakSingh31:issue-94187-2, r=compiler-er…
notriddle Oct 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 52 additions & 3 deletions library/std/src/sys/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ pub const STATUS_INVALID_PARAMETER: NTSTATUS = 0xc000000d_u32 as _;

pub const STATUS_PENDING: NTSTATUS = 0x103 as _;
pub const STATUS_END_OF_FILE: NTSTATUS = 0xC0000011_u32 as _;
#[cfg(target_arch = "x86")]
pub const STATUS_NOT_IMPLEMENTED: NTSTATUS = 0xC0000002_u32 as _;

// Equivalent to the `NT_SUCCESS` C preprocessor macro.
Expand Down Expand Up @@ -843,7 +844,8 @@ if #[cfg(not(target_vendor = "uwp"))] {
) -> BOOL;
}

#[link(name = "userenv")]
#[cfg_attr(not(target_arch = "x86"), link(name = "userenv", kind = "raw-dylib"))]
#[cfg_attr(target_arch = "x86", link(name = "userenv"))]
extern "system" {
// Allowed but unused by UWP
pub fn GetUserProfileDirectoryW(
Expand Down Expand Up @@ -1158,7 +1160,8 @@ extern "system" {
pub fn GetFileAttributesW(lpFileName: LPCWSTR) -> DWORD;
}

#[link(name = "ws2_32")]
#[cfg_attr(not(target_arch = "x86"), link(name = "ws2_32", kind = "raw-dylib"))]
#[cfg_attr(target_arch = "x86", link(name = "ws2_32"))]
extern "system" {
pub fn WSAStartup(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int;
pub fn WSACleanup() -> c_int;
Expand Down Expand Up @@ -1251,7 +1254,8 @@ extern "system" {
) -> c_int;
}

#[link(name = "bcrypt")]
#[cfg_attr(not(target_arch = "x86"), link(name = "bcrypt", kind = "raw-dylib"))]
#[cfg_attr(target_arch = "x86", link(name = "bcrypt"))]
extern "system" {
// >= Vista / Server 2008
// https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom
Expand All @@ -1270,6 +1274,47 @@ extern "system" {
pub fn BCryptCloseAlgorithmProvider(hAlgorithm: BCRYPT_ALG_HANDLE, dwFlags: ULONG) -> NTSTATUS;
}

#[cfg(not(target_arch = "x86"))]
#[link(name = "ntdll", kind = "raw-dylib")]
extern "system" {
pub fn NtCreateFile(
FileHandle: *mut HANDLE,
DesiredAccess: ACCESS_MASK,
ObjectAttributes: *const OBJECT_ATTRIBUTES,
IoStatusBlock: *mut IO_STATUS_BLOCK,
AllocationSize: *mut i64,
FileAttributes: ULONG,
ShareAccess: ULONG,
CreateDisposition: ULONG,
CreateOptions: ULONG,
EaBuffer: *mut c_void,
EaLength: ULONG,
) -> NTSTATUS;
pub fn NtReadFile(
FileHandle: BorrowedHandle<'_>,
Event: HANDLE,
ApcRoutine: Option<IO_APC_ROUTINE>,
ApcContext: *mut c_void,
IoStatusBlock: &mut IO_STATUS_BLOCK,
Buffer: *mut crate::mem::MaybeUninit<u8>,
Length: ULONG,
ByteOffset: Option<&LARGE_INTEGER>,
Key: Option<&ULONG>,
) -> NTSTATUS;
pub fn NtWriteFile(
FileHandle: BorrowedHandle<'_>,
Event: HANDLE,
ApcRoutine: Option<IO_APC_ROUTINE>,
ApcContext: *mut c_void,
IoStatusBlock: &mut IO_STATUS_BLOCK,
Buffer: *const u8,
Length: ULONG,
ByteOffset: Option<&LARGE_INTEGER>,
Key: Option<&ULONG>,
) -> NTSTATUS;
pub fn RtlNtStatusToDosError(Status: NTSTATUS) -> ULONG;
}

// Functions that aren't available on every version of Windows that we support,
// but we still use them and just provide some form of a fallback implementation.
compat_fn_with_fallback! {
Expand Down Expand Up @@ -1310,6 +1355,7 @@ compat_fn_optional! {
compat_fn_with_fallback! {
pub static NTDLL: &CStr = ansi_str!("ntdll");

#[cfg(target_arch = "x86")]
pub fn NtCreateFile(
FileHandle: *mut HANDLE,
DesiredAccess: ACCESS_MASK,
Expand All @@ -1325,6 +1371,7 @@ compat_fn_with_fallback! {
) -> NTSTATUS {
STATUS_NOT_IMPLEMENTED
}
#[cfg(target_arch = "x86")]
pub fn NtReadFile(
FileHandle: BorrowedHandle<'_>,
Event: HANDLE,
Expand All @@ -1338,6 +1385,7 @@ compat_fn_with_fallback! {
) -> NTSTATUS {
STATUS_NOT_IMPLEMENTED
}
#[cfg(target_arch = "x86")]
pub fn NtWriteFile(
FileHandle: BorrowedHandle<'_>,
Event: HANDLE,
Expand All @@ -1351,6 +1399,7 @@ compat_fn_with_fallback! {
) -> NTSTATUS {
STATUS_NOT_IMPLEMENTED
}
#[cfg(target_arch = "x86")]
pub fn RtlNtStatusToDosError(
Status: NTSTATUS
) -> ULONG {
Expand Down