| ... | @@ -120,21 +120,14 @@ pub fn rescanWindows(cb: *Bundle, gpa: Allocator) !void { | ... | @@ -120,21 +120,14 @@ pub fn rescanWindows(cb: *Bundle, gpa: Allocator) !void { |
| 120 | }; | 120 | }; |
| 121 | defer _ = w.crypt32.CertCloseStore(store, 0); | 121 | defer _ = w.crypt32.CertCloseStore(store, 0); |
| 122 | | 122 | |
| | 123 | const now_sec = std.time.timestamp(); |
| | 124 | |
| 123 | var ctx = w.crypt32.CertEnumCertificatesInStore(store, null); | 125 | var ctx = w.crypt32.CertEnumCertificatesInStore(store, null); |
| 124 | while (ctx) |context| : (ctx = w.crypt32.CertEnumCertificatesInStore(store, ctx)) { | 126 | while (ctx) |context| : (ctx = w.crypt32.CertEnumCertificatesInStore(store, ctx)) { |
| 125 | const decoded_start = @intCast(u32, cb.bytes.items.len); | 127 | const decoded_start = @intCast(u32, cb.bytes.items.len); |
| 126 | const encoded_cert = context.pbCertEncoded[0..context.cbCertEncoded]; | 128 | const encoded_cert = context.pbCertEncoded[0..context.cbCertEncoded]; |
| 127 | try cb.bytes.appendSlice(gpa, encoded_cert); | 129 | try cb.bytes.appendSlice(gpa, encoded_cert); |
| 128 | const parsed_cert = try Certificate.parse(.{ | 130 | try cb.parseCert(gpa, decoded_start, now_sec); |
| 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 | } | | |
| 138 | } | 131 | } |
| 139 | cb.bytes.shrinkAndFree(gpa, cb.bytes.items.len); | 132 | cb.bytes.shrinkAndFree(gpa, cb.bytes.items.len); |
| 140 | } | 133 | } |