about summary refs log tree commit diff
path: root/library/std/src/sys/pal/windows/c.rs
AgeCommit message (Collapse)AuthorLines
2025-08-16library: Migrate from `cfg_if` to `cfg_select`Josh Triplett-7/+5
Migrate the standard library from using the external `cfg_if` crate to using the now-built-in `cfg_select` macro. This does not yet eliminate the dependency from `library/std/Cargo.toml`, because while the standard library itself no longer uses `cfg_if`, it also incorporates the `backtrace` crate, which does. Migration assisted by the following vim command (after selecting the full `cfg_if!` invocation): ``` '<,'>s/\(cfg_if::\)\?cfg_if/cfg_select/ | '<,'>s/^\( *\)} else {/\1}\r\1_ => {/c | '<,'>s/^\( *\)} else if #\[cfg(\(.*\))\] /\1}\r\1\2 => /e | '<,'>s/if #\[cfg(\(.*\))\] {/\1 => {/e ``` This is imperfect, but substantially accelerated the process. This prompts for confirmation on the `} else {` since that can also appear inside one of the arms. This also requires manual intervention to handle any multi-line conditions.
2025-07-07UWP: link ntdll functions using raw-dylibChris Denton-60/+9
2025-06-28Workaround for mem safety in third party dllsChris Denton-7/+0
2025-06-15Windows: Use anonymous pipes in CommandChris Denton-0/+17
2025-04-04Update windows-bindgen to 0.61.0Chris Denton-2/+2
2025-03-09Lazy load NtOpenFile for UWPbdbai-0/+11
2025-03-06library: Use size_of from the prelude instead of importedThalia Archibald-3/+3
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2025-02-19Fix `*-win7-windows-msvc` target since 26eeac1a1e9fe46ffd80dd0d3dafdd2c2a644306Li Keqing-2/+2
2025-02-09Mark extern blocks as unsafeMichael Goulet-2/+2
2024-10-13sys/windows: remove miri hack that is only needed for win7Ralf Jung-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-08-21formatGeoffry Song-9/+2
2024-08-21Clean up cfg-gating of ProcessPrng externGeoffry Song-13/+16
2024-08-09Add windows-targets crate to std's sysrootChris Denton-2/+0
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+1
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-25Rollup merge of #127999 - ChrisDenton:arm32, r=AmanieuMatthias Krüger-41/+0
Inject arm32 shims into Windows metadata generation I had been keen to eventually move to using windows-sys as a normal Cargo dependency. But for linking, compile times and other reasons that's unlikely to ever happen. So if we're sticking with generated bindings then injecting any necessary missing type definitions (i.e. for the MS unsupported arm32) is simpler than defining whole functions ourselves just because we need to manually implement those types on a tier 3 platform. This also reduces the places we need to change when making changes to how we use `#[link]`. r? libs
2024-07-24Forbid unsafe_op_in_unsafe_fn in sys/pal/windowsChris Denton-4/+4
2024-07-24Import `core::ffi::c_void` in more placesChris Denton-13/+11
2024-07-23Remove wrapper functions from c.rsChris Denton-96/+12
2024-07-20Inject win arm32 shims into metadata generationChris Denton-41/+0
2024-07-15Windows: move BSD socket shims to netcChris Denton-96/+1
2024-07-15Rollup merge of #127750 - ChrisDenton:safe-unsafe-unsafe, r=workingjubileeJubilee-0/+1
Make os/windows and pal/windows default to `#![deny(unsafe_op_in_unsafe_fn)]` This is to prevent regressions in modules that currently pass. I did also fix up a few trivial places where the module contained only one or two simple wrappers. In more complex cases we should try to ensure the `unsafe` blocks are appropriately scoped and have any appropriate safety comments. This does not fix the windows bits of #127747 but it should help prevent regressions until that is done and also make it more obvious specifically which modules need attention.
2024-07-15Make pal/windows default to deny unsafe in unsafeChris Denton-0/+1
2024-07-15Fix Windows 7Chris Denton-4/+4
2024-07-15Don't re-export `c_int` from `c`Chris Denton-2/+1
2024-07-15Remove DWORDChris Denton-9/+8
2024-07-15Remove ULONGChris Denton-5/+4
2024-07-15Remove PSRWLOCKChris Denton-3/+0
2024-07-15Remove LPVOIDChris Denton-5/+3
2024-07-15Remove LPSECURITY_ATTRIBUTESChris Denton-1/+0
2024-07-15Remove LPOVERLAPPEDChris Denton-1/+0
2024-07-15Remove LPCVOIDChris Denton-1/+0
2024-07-15Remove SIZE_TChris Denton-1/+0
2024-07-15Remove CHARChris Denton-4/+3
As with USHORT, keep using C types for BSD socket APIs.
2024-07-15Remove USHORTChris Denton-4/+3
We stick to C types in for socket and address as these are at least nominally BSD-ish and they're used outside of pal/windows in general *nix code
2024-07-15Remove LPWSTRChris Denton-2/+0
2024-07-15Remove UINTChris Denton-1/+0
2024-07-15Remove LONGChris Denton-3/+1
2024-07-15Remove LARGE_INTEGERChris Denton-6/+5
2024-07-15Remove NonZeroDWORDChris Denton-2/+0
2024-07-05Use windows_targets macro for allocChris Denton-1/+1
2024-07-04Update windows-bindgen to 0.58.0Chris Denton-5/+4
2024-06-15std: refactor the TLS implementationjoboet-0/+1
As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`. Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones: * the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code. * I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps. @rustbot label +A-thread-locals
2024-04-16Use raw-dylib for Windows futex APIsChris Denton-1/+13
This is a workaround for older mingw `synchronization` import library not working on at least some system.
2024-03-11Rollup merge of #121633 - ChrisDenton:precise, r=NilstriebJacob Pratt-0/+1
Win10: Use `GetSystemTimePreciseAsFileTime` directly On Windows 10 we can use `GetSystemTimePreciseAsFileTime` directly instead of lazy loading it (with a fallback).
2024-03-09Rollup merge of #121711 - ChrisDenton:junction, r=Mark-SimulacrumGuillaume Boisseau-11/+0
Implement junction_point Implements https://github.com/rust-lang/rust/issues/121709 We already had a private implementation that we use for tests so we could just make that public. Except it was very hacky as it was only ever intended for use in testing. I've made an improved version that at least handles path conversion correctly and has less need for things like the `Align8` hack. There's still room for further improvement though.
2024-03-05Windows: Implement mutex using futexChris Denton-0/+4
Well, the Windows equivalent: `WaitOnAddress`, `WakeByAddressSingle` and `WakeByAddressAll`.
2024-02-27Implement junction_pointChris Denton-11/+0
2024-02-27Use the OS thread name by default for the current threadChris Denton-0/+6
2024-02-26Win10: Use GetSystemTimePreciseAsFileTime directlyChris Denton-0/+1