mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 02:24:33 +01:00
QueryObjectName: Add error union
This commit is contained in:
parent
9d9b5a11e8
commit
1735455099
1 changed files with 8 additions and 1 deletions
|
|
@ -1190,7 +1190,14 @@ pub fn SetFilePointerEx_CURRENT_get(handle: HANDLE) SetFilePointerError!u64 {
|
|||
return @as(u64, @bitCast(result));
|
||||
}
|
||||
|
||||
pub fn QueryObjectName(handle: HANDLE, out_buffer: []u16) ![]u16 {
|
||||
pub const QueryObjectNameError = error{
|
||||
AccessDenied,
|
||||
InvalidHandle,
|
||||
NameTooLong,
|
||||
Unexpected,
|
||||
};
|
||||
|
||||
pub fn QueryObjectName(handle: HANDLE, out_buffer: []u16) QueryObjectNameError![]u16 {
|
||||
const out_buffer_aligned = mem.alignInSlice(out_buffer, @alignOf(OBJECT_NAME_INFORMATION)) orelse return error.NameTooLong;
|
||||
|
||||
const info = @as(*OBJECT_NAME_INFORMATION, @ptrCast(out_buffer_aligned));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue