| ... | ... | @@ -120,21 +120,14 @@ pub fn rescanWindows(cb: *Bundle, gpa: Allocator) !void { |
| 120 | 120 | }; |
| 121 | 121 | defer _ = w.crypt32.CertCloseStore(store, 0); |
| 122 | 122 | |
| 123 | const now_sec = std.time.timestamp(); |
| 124 | |
| 123 | 125 | var ctx = w.crypt32.CertEnumCertificatesInStore(store, null); |
| 124 | 126 | while (ctx) |context| : (ctx = w.crypt32.CertEnumCertificatesInStore(store, ctx)) { |
| 125 | 127 | const decoded_start = @intCast(u32, cb.bytes.items.len); |
| 126 | 128 | const encoded_cert = context.pbCertEncoded[0..context.cbCertEncoded]; |
| 127 | 129 | try cb.bytes.appendSlice(gpa, encoded_cert); |
| 128 | | const parsed_cert = try Certificate.parse(.{ |
| 129 | | .buffer = cb.bytes.items, |
| 130 | | .index = decoded_start, |
| 131 | | }); |
| 132 | | const gop = try cb.map.getOrPutContext(gpa, parsed_cert.subject_slice, .{ .cb = cb }); |
| 133 | | if (gop.found_existing) { |
| 134 | | cb.bytes.items.len = decoded_start; |
| 135 | | } else { |
| 136 | | gop.value_ptr.* = decoded_start; |
| 137 | | } |
| 130 | try cb.parseCert(gpa, decoded_start, now_sec); |
| 138 | 131 | } |
| 139 | 132 | cb.bytes.shrinkAndFree(gpa, cb.bytes.items.len); |
| 140 | 133 | } |