aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os/windows.zig
AgeCommit message (Collapse)Author
2025-11-15windows: Make readLinkW APIs output WTF-16, reduce stack usage of callersRyan Liptak
- Affects the following functions: + `std.fs.Dir.readLinkW` + `std.os.windows.ReadLink` + `std.os.windows.ntToWin32Namespace` + `std.posix.readlinkW` + `std.posix.readlinkatW` Each of these functions (except `ntToWin32Namespace`) took WTF-16 as input and would output WTF-8, which makes optimal buffer re-use difficult at callsites and could force unnecessary WTF-16 <-> WTF-8 conversion during an intermediate step. The functions have been updated to output WTF-16, and also allow for the path and the output to re-use the same buffer (i.e. in-place modification), which can reduce the stack usage at callsites. For example, all of `std.fs.Dir.readLink`/`readLinkZ`/`std.posix.readlink`/`readlinkZ`/`readlinkat`/`readlinkatZ` have had their stack usage reduced by one PathSpace struct (64 KiB) when targeting Windows. The new `ntToWin32Namespace` takes an output buffer and returns a slice from that instead of returning a PathSpace, which is necessary to make the above possible.
2025-11-15windows.ReadLink: Use OpenFile now that `.filter = .any` existsRyan Liptak
The reasoning in the comment deleted by this commit no longer applies, since that same benefit can be obtained by using OpenFile with `.filter = .any`. Also removes a stray debug.print
2025-10-30Merge pull request #25763 from mrjbq7/cancelledJohn Benediktsson
rename Cancelled to Canceled
2025-10-29std.Io.Threaded: fix openSelfExe for WindowsAndrew Kelley
missing a call to wToPrefixedFileW
2025-10-29std.Io.Threaded: fix compilation failures on WindowsAndrew Kelley
2025-10-29std.Io.Threaded: implement netAccept for WindowsAndrew Kelley
2025-10-29std.Io.Threaded: implement netListen for WindowsAndrew Kelley
2025-10-29std.Io.Threaded: implement dirAccess for WindowsAndrew Kelley
2025-10-29std: fix compilation errors on WindowsAndrew Kelley
2025-10-29std: move some windows path checking logicAndrew Kelley
2025-10-29std.fs: use BadPathName rather than InvalidWtf8 on WindowsAndrew Kelley
2025-10-29fix miscellaneous compilation errorsAndrew Kelley
- ILSEQ -> error.BadPathName - implement dirStatPath for WASI
2025-10-29std: fix macos compilation errorsAndrew Kelley
2025-10-27fix: make `compiler_rt` and `std.Io.Writer` compile on 16-bit platforms.GasInfinity
2025-10-17windows: Always try using POSIX_SEMANTICS/etc for rename/deleteRyan Liptak
The compile-time check against the minimum version here wasn't appropriate, since it still makes sense to try using FILE_RENAME_INFORMATION_EX even if the minimum version is something like `xp`, since that doesn't rule out the possibility of the compiled code running on Windows 10/11. This compile-time check was doubly bad since the default minimum windows version (`.win10`) was below the `.win10_rs5` that was checked for, so when providing a target like `x86_64-windows-gnu` it'd always rule out using this syscall. After this commit, we always try using FILE_RENAME_INFORMATION_EX and then let the operating system tell us when some aspect of it is not supported. This allows us to get the benefits of these new syscalls/flags whenever it's actually possible. The possible error returns were validated experimentally: - INVALID_PARAMETER is returned when the underlying filesystem is FAT32 - INVALID_INFO_CLASS is returned on Windows 7 when trying to use FileRenameInformationEx/FileDispositionInformationEx - NOT_SUPPORTED is returned on Windows 10 >= .win10_rs5 when setting a bogus flag value (I used `0x1000`)
2025-10-17windows: make FILE_DISPOSITION_ constants pubRyan Liptak
2025-10-15std.os.windows.CONTEXT: add sp field to getRegs() result for x86Alex Rønne Petersen
2025-10-10windows: workaround kernel race conditionJacob Young
This was causing flaky CI failures.
2025-10-10replaced https://simonsapin.github.io/wtf-8/ with https://wtf-8.codeberg.page/usebeforefree
2025-09-30replace usages of old std.debug APIsmlugg
src/crash_handler.zig is still TODO though, i am planning bigger changes there
2025-08-08std.os.windows: map RtlGenRandom() failure to error.SystemResourcesAlex Rønne Petersen
Closes #23666.
2025-08-07Merge pull request #24199 from Justus2308/24106-fmt-castsMatthew Lugg
zig fmt: canonicalize nested cast builtin order
2025-08-05std: replace various mem copies with `@memmove`Andrew Kelley
2025-08-03zig fmt: apply new cast builtin orderJustus Klausecker
2025-07-15std.os.windows: restore sendmsg, sendto, recvfromAndrew Kelley
These regressed with 1a998886c863a1829d649f196093f1058cd9cf13 I'm not ready to tackle std.posix quite yet
2025-07-11Remove numerous things deprecated during the 0.14 release cycleLinus Groh
Basically everything that has a direct replacement or no uses left. Notable omissions: - std.ArrayHashMap: Too much fallout, needs a separate cleanup. - std.debug.runtime_safety: Too much fallout. - std.heap.GeneralPurposeAllocator: Lots of references to it remain, not a simple find and replace as "debug allocator" is not equivalent to "general purpose allocator". - std.io.Reader: Is being reworked at the moment. - std.unicode.utf8Decode(): No replacement, needs a new API first. - Manifest backwards compat options: Removal would break test data used by TestFetchBuilder. - panic handler needs to be a namespace: Many tests still rely on it being a function, needs a separate cleanup.
2025-07-07update standalone and incremental tests to new APIAndrew Kelley
2025-07-07std.fmt: breaking API changesAndrew Kelley
added adapter to AnyWriter and GenericWriter to help bridge the gap between old and new API make std.testing.expectFmt work at compile-time std.fmt no longer has a dependency on std.unicode. Formatted printing was never properly unicode-aware. Now it no longer pretends to be. Breakage/deprecations: * std.fs.File.reader -> std.fs.File.deprecatedReader * std.fs.File.writer -> std.fs.File.deprecatedWriter * std.io.GenericReader -> std.io.Reader * std.io.GenericWriter -> std.io.Writer * std.io.AnyReader -> std.io.Reader * std.io.AnyWriter -> std.io.Writer * std.fmt.format -> std.fmt.deprecatedFormat * std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape * std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape * std.fmt.fmtSliceHexLower -> {x} * std.fmt.fmtSliceHexUpper -> {X} * std.fmt.fmtIntSizeDec -> {B} * std.fmt.fmtIntSizeBin -> {Bi} * std.fmt.fmtDuration -> {D} * std.fmt.fmtDurationSigned -> {D} * {} -> {f} when there is a format method * format method signature - anytype -> *std.io.Writer - inferred error set -> error{WriteFailed} - options -> (deleted) * std.fmt.Formatted - now takes context type explicitly - no fmt string
2025-06-02windows: Delete obsolete environment variable kernel32 wrappers and bindingsRyan Liptak
These functions have been unused for a long time (since cfffb9c5e96eeeae43cd724e2d02ec8c2b7714e0; the PEB is used for this stuff now), and the GetEnvironmentVariableW wrapper's parameter types don't make much sense to boot. Contributes towards: - https://github.com/ziglang/zig/issues/4426 - https://github.com/ziglang/zig/issues/1840
2025-05-09std: fix `error.Unexpected` on certain Windows file operationsHydroH
Closes #23690.
2025-05-01fix(windows): handle commitment limit error in CreateProcessWDavid John
2025-04-30Fix Unexpected error for 1453 on Windows (#23729)psbob
2025-04-27Update Windows ReadFile and WriteFile to recognise Access Denied error when ↵psbob
a read or write is attempted on a disconnected virtual com port
2025-04-15Return FileNotFound when CreateProcessW is called with a missing path (#23567)phatchman
2025-04-11Merge pull request #23272 from squeek502/getenvw-optimAndrew Kelley
Windows: Faster `getenvW` and a standalone environment variable test
2025-04-03std.os.windows.PF: Add ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE.Alex Rønne Petersen
2025-03-25support more process creation options on WindowsJonathan Marler
Adds a CreateProcessFlags packed struct for all the possible flags to CreateProcessW on windows. In addition, propagates the existing `start_suspended` option in std.process.Child which was previously only used on Darwin. Also adds a `create_no_window` option to std.process.Child which is a commonly used flag for launching console executables on windows without causing a new console window to "pop up".
2025-03-24windows: Use AccessDenied for ACCESS_DENIED on WindowsPat Tullmann
Windows defines an `ACCESS_DENIED` error code. There is no PERMISSION_DENIED (or its equivalent) which seems to only exist on POSIX systems. Fix a couple Windows calls code to return `error.AccessDenied` for `ACCESS_DENIED` and to stop mapping AccessDenied into PermissionDenied.
2025-03-22windows: Document Environment pointerRyan Liptak
2025-03-04add FFI & wrappers for NtAllocateVirtualMemory & NtFreeVirtualMemory + add ↵ziggoon
missing alloction constants MEM_RESERVE_PLACEHOLDER / MEM_PRESERVE_PLACEHOLDER
2025-02-06std.heap: remove HeapAllocatorAndrew Kelley
Windows-only, depends on kernel32 in violation of zig std lib policy, and redundant with other cross-platform APIs that perform the same functionality.
2025-01-30std: fix comptime SemanticVersion expr regressionMichael Dusan
- effects FreeBSD memfd and Windows DeleteFile - regression: e5d5a8bc4ea6b27dc3540ad4800a1231ff50b33d
2025-01-26Update LDR_DATA_TABLE_ENTRY structziggoon
2025-01-16x86_64: implement switch jump tablesJacob Young
2025-01-09Sema: rewrite semantic analysis of function callsmlugg
This rewrite improves some error messages, hugely simplifies the logic, and fixes several bugs. One of these bugs is technically a new rule which Andrew and I agreed on: if a parameter has a comptime-only type but is not declared `comptime`, then the corresponding call argument should not be *evaluated* at comptime; only resolved. Implementing this required changing how function types work a little, which in turn required allowing a new kind of function coercion for some generic use cases: function coercions are now allowed to implicitly *remove* `comptime` annotations from parameters with comptime-only types. This is okay because removing the annotation affects only the call site. Resolves: #22262
2024-11-27std.os.windows: Map PIPE_NOT_AVAILABLE from OpenFile() to error.NoDevice ↵Justin Braben
(#21938)
2024-11-12std: fix compiler errorsPauloCampana
See: #20505, #21094
2024-11-04zig.h: Improve portability of zig_*_windows_teb() helpers.Alex Rønne Petersen
* Make it work for thumb and aarch64. * Clean up std.os.windows.teb() a bit. I also updated stage1/zig.h since the changes are backwards-compatible and are necessary due to the std.os.windows changes that call the newly-added functions.
2024-11-02std.os.windows: Deprecate WINAPI in favor of CallingConvention.winapi.Alex Rønne Petersen
2024-11-02std.os.windows: Fix some incorrect callconv specifiers.Alex Rønne Petersen
Closes #21869.