- for (unsigned i = 0; i <= inode->i_num_ads; i++) {
- struct wim_lookup_table_entry *lte;
- lte = inode_stream_lte(inode, i, lookup_table);
- if (lte)
- lte->real_refcnt += inode->i_nlink;
+ int ret;
+ LIST_HEAD(stream_list);
+ union wimlib_progress_info progress;
+ struct verify_stream_list_ctx ctx;
+ struct wim_lookup_table_entry *lte;
+ struct read_stream_list_callbacks cbs = {
+ .end_stream = end_verify_stream,
+ .end_stream_ctx = &ctx,
+ };
+
+ /* Check parameters */
+
+ if (!wim)
+ return WIMLIB_ERR_INVALID_PARAM;
+
+ if (verify_flags)
+ return WIMLIB_ERR_INVALID_PARAM;
+
+ /* Verify the images */
+
+ if (wim_has_metadata(wim)) {
+
+ memset(&progress, 0, sizeof(progress));
+ progress.verify_image.wimfile = wim->filename;
+ progress.verify_image.total_images = wim->hdr.image_count;
+
+ for (int i = 1; i <= wim->hdr.image_count; i++) {
+
+ progress.verify_image.current_image = i;
+
+ ret = call_progress(wim->progfunc, WIMLIB_PROGRESS_MSG_BEGIN_VERIFY_IMAGE,
+ &progress, wim->progctx);
+ if (ret)
+ return ret;
+
+ ret = select_wim_image(wim, i);
+ if (ret)
+ return ret;
+
+ ret = verify_image_streams_present(wim_get_current_image_metadata(wim),
+ wim->lookup_table);
+ if (ret)
+ return ret;
+
+ ret = call_progress(wim->progfunc, WIMLIB_PROGRESS_MSG_END_VERIFY_IMAGE,
+ &progress, wim->progctx);
+ if (ret)
+ return ret;
+ }
+ } else {
+ WARNING("\"%"TS"\" does not contain image metadata. Skipping image verification.",
+ wim->filename);