Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Private Function

getDword

Private Function
std.zig.WindowsSdk.Registry.Key.getDword
fn getDword(key: Key, entry: ValueEntry) error

Params

File

zig/WindowsSdk.zig:424
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
        fn getDword(key: Key, entry: ValueEntry) error{ ValueNameNotFound, NotADword, DwordNotFound }!windows.DWORD {
            const num_data_bytes = @sizeOf(windows.DWORD);
            const buf_len = @sizeOf(windows.KEY.VALUE.PARTIAL_INFORMATION) + num_data_bytes;
            var info_buf: [buf_len]u8 align(@alignOf(windows.KEY.VALUE.PARTIAL_INFORMATION)) = undefined;
            var result_len: windows.ULONG = undefined;
            const rc = windows.ntdll.NtQueryValueKey(
                key.handle,
                switch (entry) {
                    .name => |name| @constCast(&windows.UNICODE_STRING.init(name)),
                    .default => @constCast(&windows.UNICODE_STRING.empty),
                },
                .Partial,
                &info_buf,
                buf_len,
                &result_len,
            );
            switch (rc) {
                .SUCCESS => {},
                .OBJECT_NAME_NOT_FOUND => return error.ValueNameNotFound,
                else => return error.DwordNotFound,
            }

            const info: *const windows.KEY.VALUE.PARTIAL_INFORMATION = @ptrCast(&info_buf);

            switch (info.Type) {
                .DWORD => {},
                else => return error.NotADword,
            }

            return std.mem.bytesToValue(windows.DWORD, info.data());
        }