void xml_update_image_info(WIMStruct *w, int image)
{
struct image_info *image_info;
- struct dentry *root;
char *flags_save;
DEBUG("Updating the image info for image %d", image);
* */
void print_image_info(const struct wim_info *wim_info, int image)
{
- uint i;
const struct image_info *image_info;
const char *desc;
- int start;
- int end;
time_t time;
char *p;
* the offset of the XML data.
*/
int write_xml_data(const struct wim_info *wim_info, int image, FILE *out,
- u64 total_bytes)
+ u64 total_bytes, struct resource_entry *out_res_entry)
{
xmlBuffer *buf;
xmlTextWriter *writer;
size_t len;
size_t utf16_len;
size_t bytes_written;
+ off_t start_offset, end_offset;
- wimlib_assert(image == WIM_ALL_IMAGES ||
+ wimlib_assert(image == WIMLIB_ALL_IMAGES ||
(wim_info != NULL && image >= 1 &&
image <= wim_info->num_images));
+ start_offset = ftello(out);
+ if (start_offset == -1)
+ return WIMLIB_ERR_WRITE;
+
/* The contents of the <TOTALBYTES> element in the XML data, under the
* <WIM> element not the <IMAGE> element, is (for non-spit WIMs) the
* size of the WIM file excluding the XML data and integrity table,
if (wim_info != NULL) {
DEBUG("Writing %d <IMAGE> elements", (int)wim_info->num_images);
for (int i = 1; i <= (int)wim_info->num_images; i++) {
- if (image != WIM_ALL_IMAGES && i != image)
+ if (image != WIMLIB_ALL_IMAGES && i != image)
continue;
DEBUG("Writing <IMAGE> element for image %d", i);
ret = xml_write_image_info(writer, &wim_info->images[i - 1]);
DEBUG("Cleaning up.");
+ end_offset = ftello(out);
+ if (end_offset == -1) {
+ ret = WIMLIB_ERR_WRITE;
+ goto out_free_utf16_str;
+ }
+
+ out_res_entry->offset = start_offset;
+ out_res_entry->size = end_offset - start_offset;
+ out_res_entry->original_size = end_offset - start_offset;
+ out_res_entry->flags = WIM_RESHDR_FLAG_METADATA;
ret = 0;
out_free_utf16_str:
FREE(utf16_str);