Zig 0.17.0-dev (Split by item)
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 library itself.
Zig › std/ › crypto/ › Certificate/ › Bundle.zig › rescanWindows
rescanWindows
Bundle.rescanWindows
fn rescanWindows (cb : *Bundle , gpa : Allocator , io : Io , now : Io .Timestamp ) RescanWindowsError !void
File
Code
fn rescanWindows (cb : *Bundle , gpa : Allocator , io : Io , now : Io .Timestamp ) RescanWindowsError !void {
cb .bytes .clearRetainingCapacity ();
cb .map .clearRetainingCapacity ();
_ = io ;
const w = std .os .windows ;
const GetLastError = w .GetLastError ;
const root = [4 :0 ]u16 { 'R' , 'O' , 'O' , 'T' };
const store = w .crypt32 .CertOpenSystemStoreW (.NULL , &root ) orelse switch (GetLastError ()) {
.FILE_NOT_FOUND => return error .FileNotFound ,
else => |err | return w .unexpectedError (err ),
};
defer assert (w .crypt32 .CertCloseStore (store , .{ .CHECK = std .debug .runtime_safety }).toBool ());
const now_sec = now .toSeconds ();
var ctx = w .crypt32 .CertEnumCertificatesInStore (store , null );
while (ctx ) |context | : (ctx = w .crypt32 .CertEnumCertificatesInStore (store , ctx )) {
const decoded_start = @as (u32 , @intCast (cb .bytes .items .len ));
const encoded_cert = context .pbCertEncoded [0 ..context .cbCertEncoded ];
try cb .bytes .appendSlice (gpa , encoded_cert );
try cb .parseCert (gpa , decoded_start , now_sec );
}
cb .bytes .shrinkAndFree (gpa , cb .bytes .items .len );
}