about summary refs log tree commit diff
path: root/library/std/src/sys/pal/windows
AgeCommit message (Collapse)AuthorLines
2024-02-17Rollup merge of #119032 - smmalis37:patch-1, r=ChrisDentonGuillaume Boisseau-5/+25
Use a hardcoded constant instead of calling OpenProcessToken. Now that Win 7 support is dropped, we can resurrect #90144. GetCurrentProcessToken is defined in processthreadsapi.h as: FORCEINLINE HANDLE GetCurrentProcessToken ( VOID ) { return (HANDLE)(LONG_PTR) -4; } Since it's very unlikely that this constant will ever change, let's just use it instead of making calls to get the same information.
2024-02-17Auto merge of #120741 - a1phyr:safe_buffer_advance, r=m-ou-sebors-3/+3
Make `io::BorrowedCursor::advance` safe This also keeps the old `advance` method under `advance_unchecked` name. This makes pattern like `std::io::default_read_buf` safe to write.
2024-02-16Remove cfg_attrSteven-1/+0
2024-02-16Use a hardcoded constant instead of calling OpenProcessToken.Steven-5/+26
Now that Win 7 support is dropped, we can resurrect #90144. GetCurrentProcessToken is defined in processthreadsapi.h as: FORCEINLINE HANDLE GetCurrentProcessToken ( VOID ) { return (HANDLE)(LONG_PTR) -4; } Since it's very unlikely that this constant will ever change, let's just use it instead of making calls to get the same information.
2024-02-16std: move locks to `sys` on Windowsjoboet-151/+0
2024-02-16Auto merge of #120486 - reitermarkus:use-generic-nonzero, r=dtolnaybors-13/+13
Use generic `NonZero` internally. Tracking issue: https://github.com/rust-lang/rust/issues/120257
2024-02-15Replace `NonZero::<_>::new` with `NonZero::new`.Markus Reiter-3/+3
2024-02-15Use generic `NonZero` internally.Markus Reiter-13/+13
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-02-08std: move path into `sys`joboet-485/+3
2024-02-07Make `io::BorrowedCursor::advance` safeBenoît du Garreau-3/+3
This also keeps the old `advance` method under `advance_unchecked` name. This makes pattern like `std::io::default_read_buf` safe to write.
2024-01-30Rollup merge of #120295 - reitermarkus:remove-ffi-nonzero, r=dtolnayGuillaume Gomez-2/+2
Remove `raw_os_nonzero` feature. This feature is superseded by a generic `NonZero` type: https://github.com/rust-lang/rust/issues/120257 Closes https://github.com/rust-lang/rust/issues/82363.
2024-01-29Remove `raw_os_nonzero` feature.Markus Reiter-2/+2
2024-01-29Rollup merge of #120373 - HTGAzureX1212:HTGAzureX1212/issue-120040, ↵Dylan DPC-1/+33
r=ChrisDenton Adjust Behaviour of `read_dir` and `ReadDir` in Windows Implementation: Check Whether Path to Search In Exists This pull request changes the `read_dir` function's and the `ReadDir` structure's internal implementations for the Windows operating system to make its behaviour more accurate. It should be noted that `ERROR_FILE_NOT_FOUND` is returned by the `FindFirstFileW` function when *no matching files can be found*, not necessarily that the path to search in does not exist in the first place. Therefore, directly returning the "The system cannot find the file specified." may not be accurate. An extra check for whether the path to search in exists is added, returning a constructed `ReadDir` iterator with its handle being an `INVALID_HANDLE_VALUE` returned by the `FindFirstFileW` function if `ERROR_FILE_NOT_FOUND` is indeed the last OS error. The `ReadDir` implementation for the Windows operating system is correspondingly updated to always return `None` if the handle it has is an `INVALID_HANDLE_VALUE` which can only be the case if and only if specifically constructed by the `read_dir` function in the aforementioned conditions. It should also be noted that `FindFirstFileW` would have returned `ERROR_PATH_NOT_FOUND` if the path to search in does not exist in the first place. Presumably fixes #120040.
2024-01-27add extra check for invalid handle in ReadDir::nextHTGAzureX1212.-1/+8
2024-01-27make modifications as per reviewsHTGAzureX1212.-21/+25
2024-01-26Rollup merge of #120205 - Berrysoft:windows-alloc-init, r=ChrisDentonMatthias Krüger-11/+13
std: make `HEAP` initializer never inline The system allocator for Windows calls `init_or_get_process_heap` every time allocating. It generates very much useless code and makes the binary larger. The `HEAP` only needs to initialize once before the main fn. Concerns: * I'm not sure if `init` will be properly called in cdylib. * Do we need to ensure the allocator works if the user enables `no_main`? * Should we panic if `GetProcessHeap` returns null?
2024-01-26fixHTGAzureX1212.-2/+2
2024-01-26remove redundant call to Error::last_os_errorHTGAzureX1212.-1/+1
2024-01-26fix issue 120040HTGAzureX1212.-0/+21
2024-01-24Wrap `HeapAlloc` and never inline王宇逸-11/+13
2024-01-22Rollup merge of #120109 - joboet:move_pal_cmath, r=ChrisDentonMatthias Krüger-97/+0
Move cmath into `sys` Part of #117276. r? ``@ChrisDenton``
2024-01-22std: move cmath into `sys`joboet-97/+0
2024-01-22Fix msys2 tty detection for /dev/ptmxChris Denton-14/+0
Our "true negative" detection assumes that if at least one std handle is a Windows console then no other handle will be a msys2 tty pipe. This turns out to be a faulty assumption in the case of `/dev/ptmx`.
2024-01-15std: move OS String implementation into `sys`joboet-246/+0
2024-01-12update paths in commentsjoboet-2/+2
2024-01-11std: fix module references on Windowsjoboet-5/+5
2024-01-11std: begin moving platform support modules into `pal`joboet-0/+16225