about summary refs log tree commit diff
path: root/library/std/src/sys/pal/windows/c
AgeCommit message (Collapse)AuthorLines
2025-09-29std: implement `hostname`joboet-0/+4
2025-08-14Windows: Replace `GetThreadId`+`GetCurrentThread` with `GetCurrentThreadId`Trevor Gross-2/+2
Reference: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentthreadid
2025-08-06Print thread ID in panic message if thread name is unknownTrevor Gross-0/+2
`panic!` does not print any identifying information for threads that are unnamed. However, in many cases, the thread ID can be determined. This changes the panic message from something like this: thread '<unnamed>' panicked at src/main.rs:3:5: explicit panic To something like this: thread '<unnamed>' (0xff9bf) panicked at src/main.rs:3:5: explicit panic Stack overflow messages are updated as well. This change applies to both named and unnamed threads. The ID printed is the OS integer thread ID rather than the Rust thread ID, which should also be what debuggers print.
2025-06-15Windows: Use anonymous pipes in CommandChris Denton-1/+35
2025-06-05Optimize `Seek::stream_len` impl for `File`Tobias Bucher-0/+2
It uses the file metadata on Unix with a fallback for files incorrectly reported as zero-sized. It uses `GetFileSizeEx` on Windows. This reduces the number of syscalls needed for determining the file size of an open file from 3 to 1.
2025-04-04Update windows-bindgen to 0.61.0Chris Denton-25/+282
2025-02-13Windows: Update generated bindings to 0.59Chris Denton-2732/+2768
2024-12-27Rollup merge of #134622 - ChrisDenton:write-file-utf8, r=Mark-Simulacrum许杰友 Jieyou Xu (Joe)-0/+3
Windows: Use WriteFile to write to a UTF-8 console If the console code page is UTF-8 then we can simply write to it without needing to convert to UTF-16 and calling `WriteConsole`.
2024-12-21Rollup merge of #131072 - Fulgen301:windows-rename-posix-semantics, ↵Matthias Krüger-0/+19
r=ChrisDenton Win: Use POSIX rename semantics for `std::fs::rename` if available Windows 10 1601 introduced `FileRenameInfoEx` as well as `FILE_RENAME_FLAG_POSIX_SEMANTICS`, allowing for atomic renaming and renaming if the target file is has already been opened with `FILE_SHARE_DELETE`, in which case the file gets renamed on disk while the open file handle still refers to the old file, just like in POSIX. This resolves #123985, where atomic renaming proved difficult to impossible due to race conditions. If `FileRenameInfoEx` isn't available due to missing support from the underlying filesystem or missing OS support, the renaming is retried with `FileRenameInfo`, which matches the behavior of `MoveFileEx`. This PR also manually replicates parts of `MoveFileEx`'s internal logic, as reverse-engineered from the disassembly: If the source file is a reparse point and said reparse point is a mount point, the mount point itself gets renamed; otherwise the reparse point is resolved and the result renamed. Notes: - Currently, the `win7` target doesn't bother with `FileRenameInfoEx` at all; it's probably desirable to remove that special casing and try `FileRenameInfoEx` anyway if it doesn't exist, in case the binary is run on newer OS versions. Fixes #123985
2024-12-21Windows: Use WriteFile to write to a UTF-8 consoleChris Denton-0/+3
2024-11-11Rollup merge of #130999 - cberner:flock_pr, r=joboetMatthias Krüger-0/+9
Implement file_lock feature This adds lock(), lock_shared(), try_lock(), try_lock_shared(), and unlock() to File gated behind the file_lock feature flag This is the initial implementation of https://github.com/rust-lang/rust/issues/130994 for Unix and Windows platforms. I will follow it up with an implementation for WASI preview 2
2024-10-20replace FindFirstFileW with FindFirstFileExW and regenerate bindingsklensy-3/+9
2024-10-13Implement file_lock featureChristopher Berner-0/+9
This adds lock(), lock_shared(), try_lock(), try_lock_shared(), and unlock() to File gated behind the file_lock feature flag
2024-09-30Win: Use `FILE_RENAME_FLAG_POSIX_SEMANTICS` for `std::fs::rename` if availableGeorge Tokmaji-0/+19
Windows 10 1601 introduced `FileRenameInfoEx` as well as `FILE_RENAME_FLAG_POSIX_SEMANTICS`, allowing for atomic renaming. If it isn't supported, we fall back to `FileRenameInfo`. This commit also replicates `MoveFileExW`'s behavior of checking whether the source file is a mount point and moving the mount point instead of resolving the target path.
2024-08-31Move remove_dir_all impl into a moduleChris Denton-0/+10
2024-08-09Add windows-targets crate to std's sysrootChris Denton-38/+0
2024-07-25Rollup merge of #127999 - ChrisDenton:arm32, r=AmanieuMatthias Krüger-0/+26
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-24Auto merge of #127153 - NobodyXu:pipe, r=ChrisDentonbors-0/+2
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: #127154 try-job: x86_64-msvc try-job: i686-mingw
2024-07-23Initial implementation of anonymous_pipeJiahao XU-0/+2
Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com> Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com> Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-07-20Inject win arm32 shims into metadata generationChris Denton-0/+26
2024-07-15Windows: move BSD socket shims to netcChris Denton-0/+9
2024-07-05Add experimental raw-dylib feature to stdChris Denton-0/+13
For Windows, this allows defining imports without needing the user to have import libraries. It's intended for this to become the default.
2024-07-04Add comments to windows_targets.rsChris Denton-0/+9
2024-07-04Update windows-bindgen to 0.58.0Chris Denton-839/+148
2024-06-10Bump windows-bindgen to 0.57Chris Denton-417/+66
2024-06-05Update `./x fmt` commandChris Denton-1/+1
2024-04-15Add support for Arm64EC to the Standard LibraryDaniel Paoliello-20/+20
2024-03-12Bump windows-bindgen to 0.55.0Chris Denton-183/+181
2024-03-12Bump windows-bindgen to 0.54.0Chris Denton-31/+31
2024-03-11Rollup merge of #121633 - ChrisDenton:precise, r=NilstriebJacob Pratt-0/+5
Win10: Use `GetSystemTimePreciseAsFileTime` directly On Windows 10 we can use `GetSystemTimePreciseAsFileTime` directly instead of lazy loading it (with a fallback).
2024-03-03Auto merge of #121856 - ChrisDenton:abort, r=joboetbors-0/+2
Cleanup windows `abort_internal` As the comments on the functions say, we define abort in both in panic_abort and in libstd. This PR makes the two implementation (mostly) the same. Additionally it: * uses `options(noreturn)` on the asm instead of using `core::intrinsics::unreachable`. * removed unnecessary allow lints * added `FAST_FAIL_FATAL_APP_EXIT` to our generated Windows API bindings instead of defining it manually (std only)
2024-03-02Cleanup windows abort_internalChris Denton-0/+2
2024-02-27Use the OS thread name by default for the current threadChris Denton-0/+6
2024-02-26Win10: Use GetSystemTimePreciseAsFileTime directlyChris Denton-0/+5
2024-02-25Windows: Use ProcessPrng for random keysChris Denton-16/+0
2024-02-14Automatically sort windows_sys bindingsChris Denton-8/+1
2024-02-14Add windows_sys readmeChris Denton-0/+9
2024-02-14Move windows_sys.lst to bindings.txtChris Denton-1/+0
2024-01-11std: begin moving platform support modules into `pal`joboet-0/+6949