aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-10-19 21:12:19 -0700
committerAndrew Kelley <andrew@ziglang.org>2025-10-29 06:20:50 -0700
commitaa6e8eff40bdf35c838c8cd93080f2e9d4fad3b2 (patch)
tree3d39b4b01c9d6af60dc8a83f5950535ddecfc5a7 /lib/std/os
parent482343f2e253f2078627e696fb98ff0e1d8e82df (diff)
downloadzig-aa6e8eff40bdf35c838c8cd93080f2e9d4fad3b2.tar.gz
zig-aa6e8eff40bdf35c838c8cd93080f2e9d4fad3b2.zip
std.Io.Threaded: implement dirAccess for Windows
Diffstat (limited to 'lib/std/os')
-rw-r--r--lib/std/os/windows.zig19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig
index fd6e2926c9..f1649fafc1 100644
--- a/lib/std/os/windows.zig
+++ b/lib/std/os/windows.zig
@@ -89,7 +89,7 @@ pub fn OpenFile(sub_path_w: []const u16, options: OpenFileOptions) OpenError!HAN
};
var attr = OBJECT_ATTRIBUTES{
.Length = @sizeOf(OBJECT_ATTRIBUTES),
- .RootDirectory = if (std.fs.path.isAbsoluteWindowsWTF16(sub_path_w)) null else options.dir,
+ .RootDirectory = if (std.fs.path.isAbsoluteWindowsWtf16(sub_path_w)) null else options.dir,
.Attributes = if (options.sa) |ptr| blk: { // Note we do not use OBJ_CASE_INSENSITIVE here.
const inherit: ULONG = if (ptr.bInheritHandle == TRUE) OBJ_INHERIT else 0;
break :blk inherit;
@@ -847,7 +847,7 @@ pub fn CreateSymbolicLink(
// the C:\ drive.
.rooted => break :target_path target_path,
// Keep relative paths relative, but anything else needs to get NT-prefixed.
- else => if (!std.fs.path.isAbsoluteWindowsWTF16(target_path))
+ else => if (!std.fs.path.isAbsoluteWindowsWtf16(target_path))
break :target_path target_path,
},
// Already an NT path, no need to do anything to it
@@ -856,7 +856,7 @@ pub fn CreateSymbolicLink(
}
var prefixed_target_path = try wToPrefixedFileW(dir, target_path);
// We do this after prefixing to ensure that drive-relative paths are treated as absolute
- is_target_absolute = std.fs.path.isAbsoluteWindowsWTF16(prefixed_target_path.span());
+ is_target_absolute = std.fs.path.isAbsoluteWindowsWtf16(prefixed_target_path.span());
break :target_path prefixed_target_path.span();
};
@@ -864,7 +864,7 @@ pub fn CreateSymbolicLink(
var buffer: [MAXIMUM_REPARSE_DATA_BUFFER_SIZE]u8 = undefined;
const buf_len = @sizeOf(SYMLINK_DATA) + final_target_path.len * 4;
const header_len = @sizeOf(ULONG) + @sizeOf(USHORT) * 2;
- const target_is_absolute = std.fs.path.isAbsoluteWindowsWTF16(final_target_path);
+ const target_is_absolute = std.fs.path.isAbsoluteWindowsWtf16(final_target_path);
const symlink_data = SYMLINK_DATA{
.ReparseTag = IO_REPARSE_TAG_SYMLINK,
.ReparseDataLength = @intCast(buf_len - header_len),
@@ -905,7 +905,7 @@ pub fn ReadLink(dir: ?HANDLE, sub_path_w: []const u16, out_buffer: []u8) ReadLin
};
var attr = OBJECT_ATTRIBUTES{
.Length = @sizeOf(OBJECT_ATTRIBUTES),
- .RootDirectory = if (std.fs.path.isAbsoluteWindowsWTF16(sub_path_w)) null else dir,
+ .RootDirectory = if (std.fs.path.isAbsoluteWindowsWtf16(sub_path_w)) null else dir,
.Attributes = 0, // Note we do not use OBJ_CASE_INSENSITIVE here.
.ObjectName = &nt_name,
.SecurityDescriptor = null,
@@ -1035,7 +1035,7 @@ pub fn DeleteFile(sub_path_w: []const u16, options: DeleteFileOptions) DeleteFil
var attr = OBJECT_ATTRIBUTES{
.Length = @sizeOf(OBJECT_ATTRIBUTES),
- .RootDirectory = if (std.fs.path.isAbsoluteWindowsWTF16(sub_path_w)) null else options.dir,
+ .RootDirectory = if (std.fs.path.isAbsoluteWindowsWtf16(sub_path_w)) null else options.dir,
.Attributes = 0, // Note we do not use OBJ_CASE_INSENSITIVE here.
.ObjectName = &nt_name,
.SecurityDescriptor = null,
@@ -2885,6 +2885,13 @@ pub fn unexpectedStatus(status: NTSTATUS) UnexpectedError {
return error.Unexpected;
}
+pub fn statusBug(status: NTSTATUS) UnexpectedError {
+ switch (builtin.mode) {
+ .Debug => std.debug.panic("programmer bug caused syscall status: {t}", .{status}),
+ else => return error.Unexpected,
+ }
+}
+
pub const Win32Error = @import("windows/win32error.zig").Win32Error;
pub const NTSTATUS = @import("windows/ntstatus.zig").NTSTATUS;
pub const LANG = @import("windows/lang.zig");