Skip to content

Commit 1735455

Browse files
QueryObjectName: Add error union
1 parent 9d9b5a1 commit 1735455

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/std/os/windows.zig

+8-1
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,14 @@ pub fn SetFilePointerEx_CURRENT_get(handle: HANDLE) SetFilePointerError!u64 {
11901190
return @as(u64, @bitCast(result));
11911191
}
11921192

1193-
pub fn QueryObjectName(handle: HANDLE, out_buffer: []u16) ![]u16 {
1193+
pub const QueryObjectNameError = error{
1194+
AccessDenied,
1195+
InvalidHandle,
1196+
NameTooLong,
1197+
Unexpected,
1198+
};
1199+
1200+
pub fn QueryObjectName(handle: HANDLE, out_buffer: []u16) QueryObjectNameError![]u16 {
11941201
const out_buffer_aligned = mem.alignInSlice(out_buffer, @alignOf(OBJECT_NAME_INFORMATION)) orelse return error.NameTooLong;
11951202

11961203
const info = @as(*OBJECT_NAME_INFORMATION, @ptrCast(out_buffer_aligned));

0 commit comments

Comments
 (0)