zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 3cc5dda7568b845d5002be4dd3181145ecc3f8bd (tree)
parent 649aaf4814f8b74d9f90c0aaa09cbaf1901a6650
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed, 28 Jan 2026 23:18:24 -0800

fix RtlGetCurrentDirectory_U parameter

it's the byte length not number of wchars

Diffstat:
Mlib/std/Io/Threaded.zig | 2+-
Mlib/std/os/windows/ntdll.zig | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig @@ -12607,7 +12607,7 @@ fn processCurrentDir(userdata: ?*anyopaque, buffer: []u8) process.CurrentDirErro _ = t; if (is_windows) { var wtf16le_buf: [windows.PATH_MAX_WIDE:0]u16 = undefined; - const n = windows.ntdll.RtlGetCurrentDirectory_U(wtf16le_buf.len + 1, &wtf16le_buf); + const n = windows.ntdll.RtlGetCurrentDirectory_U(wtf16le_buf.len * 2 + 2, &wtf16le_buf) / 2; if (n == 0) return error.Unexpected; assert(n <= wtf16le_buf.len); const wtf16le_slice = wtf16le_buf[0..n]; diff --git a/lib/std/os/windows/ntdll.zig b/lib/std/os/windows/ntdll.zig @@ -497,7 +497,7 @@ pub extern "ntdll" fn RtlGetFullPathName_U( ) callconv(.winapi) ULONG; pub extern "ntdll" fn RtlGetCurrentDirectory_U( - BufferLength: ULONG, + BufferByteLength: ULONG, Buffer: [*]u16, ) callconv(.winapi) ULONG;