* modify.c
*
* Support for modifying WIM files with image-level operations (delete an image,
- * add an image, export an imagex from one WIM to another.) There is nothing
+ * add an image, export an image from one WIM to another.) There is nothing
* here that lets you change individual files in the WIM; for that you will need
* to look at the filesystem implementation in mount.c.
*/
*/
WIMLIBAPI int wimlib_delete_image(WIMStruct *w, int image)
{
- int num_images;
int i;
int ret;
}
if (image == WIM_ALL_IMAGES) {
- num_images = w->hdr.image_count;
- for (i = 1; i <= num_images; i++) {
- /* Always delete the first image, since by the end
- * there won't be any more than that! */
- ret = wimlib_delete_image(w, 1);
+ for (i = w->hdr.image_count; i >= 1; i--) {
+ ret = wimlib_delete_image(w, i);
if (ret != 0)
return ret;
}
/* Free the dentry tree, any lookup table entries that have their
* refcnt decremented to 0, and the security data. */
- destroy_image_metadata(wim_get_current_image_metadata(w),
- w->lookup_table);
+ destroy_image_metadata(&w->image_metadata[image - 1], w->lookup_table);
/* Get rid of the empty slot in the image metadata array. */
memmove(&w->image_metadata[image - 1], &w->image_metadata[image],
* @param image
* The number of the image to delete, or ::WIM_ALL_IMAGES to delete all
* images.
- * @return 0 on success; nonzero on error. On error, @a wim is left in an
- * indeterminate state and should be freed with wimlib_free().
+ * @return 0 on success; nonzero on failure. On failure, @a wim is guaranteed
+ * to be left unmodified only if @a image specified a single image. If instead
+ * @a image was ::WIM_ALL_IMAGES and @a wim contained more than one image, it's
+ * possible for some but not all of the images to have been deleted when a
+ * failure status is returned.
+ *
* @retval ::WIMLIB_ERR_DECOMPRESSION
* Could not decompress the metadata resource for @a image.
* @retval ::WIMLIB_ERR_INVALID_DENTRY
FREE(windows_info->product_name);
FREE(windows_info->edition_id);
FREE(windows_info->installation_type);
+ FREE(windows_info->hal);
FREE(windows_info->product_type);
+ FREE(windows_info->product_suite);
for (i = 0; i < windows_info->num_languages; i++)
FREE(windows_info->languages[i]);
FREE(windows_info->languages);
+ FREE(windows_info->default_language);
FREE(windows_info->system_root);
}