+ memset(info, 0, sizeof(struct wimlib_wim_info));
+ memcpy(info->guid, wim->hdr.guid, WIMLIB_GUID_LEN);
+ info->image_count = wim->hdr.image_count;
+ info->boot_index = wim->hdr.boot_idx;
+ info->wim_version = WIM_VERSION;
+ info->chunk_size = WIM_CHUNK_SIZE;
+ info->part_number = wim->hdr.part_number;
+ info->total_parts = wim->hdr.total_parts;
+ info->compression_type = wim->compression_type;
+ if (wim->wim_info)
+ info->total_bytes = wim->wim_info->total_bytes;
+ else
+ info->total_bytes = 0;
+ info->has_integrity_table = wim->hdr.integrity.offset != 0;
+ info->opened_from_file = (wim->filename != NULL);
+ info->is_readonly = (wim->hdr.flags & WIM_HDR_FLAG_READONLY) ||
+ (wim->hdr.total_parts != 1) ||
+ (wim->filename && taccess(wim->filename, W_OK));
+ info->has_rpfix = (wim->hdr.flags & WIM_HDR_FLAG_RP_FIX) != 0;
+ info->is_marked_readonly = (wim->hdr.flags & WIM_HDR_FLAG_READONLY) != 0;
+ info->write_in_progress = (wim->hdr.flags & WIM_HDR_FLAG_WRITE_IN_PROGRESS) != 0;
+ info->metadata_only = (wim->hdr.flags & WIM_HDR_FLAG_METADATA_ONLY) != 0;
+ info->resource_only = (wim->hdr.flags & WIM_HDR_FLAG_RESOURCE_ONLY) != 0;
+ info->spanned = (wim->hdr.flags & WIM_HDR_FLAG_SPANNED) != 0;
+ return 0;
+}
+
+
+/* Deprecated */
+WIMLIBAPI int
+wimlib_get_boot_idx(const WIMStruct *wim)
+{
+ struct wimlib_wim_info info;
+
+ wimlib_get_wim_info((WIMStruct*)wim, &info);
+ return info.boot_index;
+}
+
+/* Deprecated */
+WIMLIBAPI int
+wimlib_get_compression_type(const WIMStruct *wim)
+{
+ struct wimlib_wim_info info;
+
+ wimlib_get_wim_info((WIMStruct*)wim, &info);
+ return info.compression_type;
+}
+
+/* Deprecated */
+WIMLIBAPI int
+wimlib_get_num_images(const WIMStruct *wim)
+{
+ struct wimlib_wim_info info;
+
+ wimlib_get_wim_info((WIMStruct*)wim, &info);
+ return info.image_count;
+}
+
+/* Deprecated */
+WIMLIBAPI int
+wimlib_get_part_number(const WIMStruct *wim, int *total_parts_ret)
+{
+ struct wimlib_wim_info info;
+
+ wimlib_get_wim_info((WIMStruct*)wim, &info);
+ if (total_parts_ret)
+ *total_parts_ret = info.total_parts;
+ return info.part_number;
+}
+
+/* Deprecated */
+WIMLIBAPI bool
+wimlib_has_integrity_table(const WIMStruct *wim)
+{
+ struct wimlib_wim_info info;
+
+ wimlib_get_wim_info((WIMStruct*)wim, &info);
+ return info.has_integrity_table;
+}
+
+WIMLIBAPI int
+wimlib_set_wim_info(WIMStruct *wim, const struct wimlib_wim_info *info, int which)
+{
+ int ret;
+
+ if (which & WIMLIB_CHANGE_READONLY_FLAG) {
+ if (info->is_marked_readonly)
+ wim->hdr.flags |= WIM_HDR_FLAG_READONLY;
+ else
+ wim->hdr.flags &= ~WIM_HDR_FLAG_READONLY;