X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fadd_image.c;h=b4eb0a9eda46de114a0a04b266b6ab3ee13f1b32;hb=542225070ab6583b6f5915172425cac6e0326d77;hp=cff982034fd1d9e2e07bbccd31045eeeeb550d0b;hpb=3de1ec66f778edda19865482d685bc6f4e17faf7;p=wimlib diff --git a/src/add_image.c b/src/add_image.c index cff98203..b4eb0a9e 100644 --- a/src/add_image.c +++ b/src/add_image.c @@ -48,8 +48,8 @@ add_empty_image_metadata(WIMStruct *wim) if (!metadata_blob) goto out; - metadata_blob->flags = WIM_RESHDR_FLAG_METADATA; - metadata_blob->unhashed = 1; + metadata_blob->refcnt = 1; + metadata_blob->is_metadata = 1; /* Create empty security data (no security descriptors). */ sd = new_wim_security_data(); @@ -65,7 +65,6 @@ add_empty_image_metadata(WIMStruct *wim) imd->root_dentry = NULL; imd->metadata_blob = metadata_blob; imd->security_data = sd; - imd->modified = 1; /* Append as next image index. */ ret = append_image_metadata(wim, imd); @@ -87,9 +86,6 @@ wimlib_add_empty_image(WIMStruct *wim, const tchar *name, int *new_idx_ret) { int ret; - if (!name) - name = T(""); - if (wimlib_image_name_in_use(wim, name)) { ERROR("There is already an image named \"%"TS"\" in the WIM!", name); @@ -100,7 +96,7 @@ wimlib_add_empty_image(WIMStruct *wim, const tchar *name, int *new_idx_ret) if (ret) return ret; - ret = xml_add_image(wim, name); + ret = xml_add_image(wim->xml_info, name); if (ret) { put_image_metadata(wim->image_metadata[--wim->hdr.image_count], NULL); @@ -179,14 +175,17 @@ wimlib_add_image_multisource(WIMStruct *wim, if (ret) goto out_delete_image; + /* If requested, mark the new image as WIMBoot-compatible. */ + if (add_flags & WIMLIB_ADD_FLAG_WIMBOOT) { + ret = xml_set_wimboot(wim->xml_info, wim->hdr.image_count); + if (ret) + goto out_delete_image; + } + /* If requested, set this image as the WIM's bootable image. */ if (add_flags & WIMLIB_ADD_FLAG_BOOT) wim->hdr.boot_idx = wim->hdr.image_count; - /* If requested, mark new image as WIMBoot-compatible. */ - if (add_flags & WIMLIB_ADD_FLAG_WIMBOOT) - wim_info_set_wimboot(wim->wim_info, wim->hdr.image_count, true); - return 0; out_delete_image: