authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-28 23:18:24-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-29 18:40:56-08:00
log3cc5dda7568b845d5002be4dd3181145ecc3f8bd
tree6568f799219a22108c4fd1a0a690a188a5f7e471
parent649aaf4814f8b74d9f90c0aaa09cbaf1901a6650

fix RtlGetCurrentDirectory_U parameter

it's the byte length not number of wchars

2 files changed, 2 insertions(+), 2 deletions(-)

lib/std/Io/Threaded.zig+1-1
......@@ -12607,7 +12607,7 @@ fn processCurrentDir(userdata: ?*anyopaque, buffer: []u8) process.CurrentDirErro
1260712607 _ = t;
1260812608 if (is_windows) {
1260912609 var wtf16le_buf: [windows.PATH_MAX_WIDE:0]u16 = undefined;
12610 const n = windows.ntdll.RtlGetCurrentDirectory_U(wtf16le_buf.len + 1, &wtf16le_buf);
12610 const n = windows.ntdll.RtlGetCurrentDirectory_U(wtf16le_buf.len * 2 + 2, &wtf16le_buf) / 2;
1261112611 if (n == 0) return error.Unexpected;
1261212612 assert(n <= wtf16le_buf.len);
1261312613 const wtf16le_slice = wtf16le_buf[0..n];
lib/std/os/windows/ntdll.zig+1-1
......@@ -497,7 +497,7 @@ pub extern "ntdll" fn RtlGetFullPathName_U(
497497) callconv(.winapi) ULONG;
498498
499499pub extern "ntdll" fn RtlGetCurrentDirectory_U(
500 BufferLength: ULONG,
500 BufferByteLength: ULONG,
501501 Buffer: [*]u16,
502502) callconv(.winapi) ULONG;
503503