Skip to content

Commit bf3a54c

Browse files
QueryObjectName: Add error union
1 parent f1c0f42 commit bf3a54c

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
@@ -1186,7 +1186,14 @@ pub fn SetFilePointerEx_CURRENT_get(handle: HANDLE) SetFilePointerError!u64 {
11861186
return @as(u64, @bitCast(result));
11871187
}
11881188

1189-
pub fn QueryObjectName(handle: HANDLE, out_buffer: []u16) ![]u16 {
1189+
pub const QueryObjectNameError = error{
1190+
AccessDenied,
1191+
InvalidHandle,
1192+
NameTooLong,
1193+
Unexpected,
1194+
};
1195+
1196+
pub fn QueryObjectName(handle: HANDLE, out_buffer: []u16) QueryObjectNameError![]u16 {
11901197
const out_buffer_aligned = mem.alignInSlice(out_buffer, @alignOf(OBJECT_NAME_INFORMATION)) orelse return error.NameTooLong;
11911198

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

0 commit comments

Comments
 (0)