- args.w = w;
- args.swm_base_name = swm_base_name;
- args.swm_base_name_len = swm_base_name_len;
- args.swm_suffix = swm_suffix;
- INIT_LIST_HEAD(&args.lte_list);
- args.cur_part_number = 1;
- args.write_flags = write_flags;
- args.size_remaining = part_size;
- args.part_size = part_size;
- args.progress_func = progress_func;
- args.progress.split.total_bytes = lookup_table_total_stream_size(w->lookup_table);
- args.progress.split.cur_part_number = 1;
- args.progress.split.completed_bytes = 0;
- args.progress.split.part_name = swm_base_name;
-
- if (progress_func) {
- progress_func(WIMLIB_PROGRESS_MSG_SPLIT_BEGIN_PART,
- &args.progress);
- }
-
- w->write_metadata = true;
- for (int i = 0; i < w->hdr.image_count; i++) {
- struct wim_lookup_table_entry *metadata_lte;
- metadata_lte = w->image_metadata[i].metadata_lte;
- ret = copy_resource(metadata_lte, w);
- if (ret != 0)
- goto out;
- args.size_remaining -= metadata_lte->resource_entry.size;
- args.progress.split.completed_bytes += metadata_lte->resource_entry.size;
- list_add(&metadata_lte->staging_list, &args.lte_list);
+ for (i = 0; i < wim->hdr.image_count; i++) {
+ if (!is_image_unchanged_from_wim(wim->image_metadata[i], wim)) {
+ ERROR("Only an unmodified, on-disk WIM file can be split.");
+ return WIMLIB_ERR_UNSUPPORTED;
+ }