From: Eric Biggers Date: Mon, 19 Nov 2012 04:27:50 +0000 (-0600) Subject: wimlib_set_boot_idx(): Update boot metadata immediately X-Git-Tag: v1.2.0~33 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=3db96e21c9c03d1797c471fa47fafdd65b71cf11 wimlib_set_boot_idx(): Update boot metadata immediately Update the boot metadata resource entry in the WIM header as soon as wimlib_set_boot_idx() is called. Otherwise, the correct entry is never updated if wimlib_overwrite_xml_and_header() is called. --- diff --git a/src/wim.c b/src/wim.c index ed6ab33d..3e9b4523 100644 --- a/src/wim.c +++ b/src/wim.c @@ -391,6 +391,17 @@ WIMLIBAPI int wimlib_set_boot_idx(WIMStruct *w, int boot_idx) if (boot_idx < 0 || boot_idx > w->hdr.image_count) return WIMLIB_ERR_INVALID_IMAGE; w->hdr.boot_idx = boot_idx; + + if (boot_idx == 0) { + memset(&w->hdr.boot_metadata_res_entry, 0, + sizeof(struct resource_entry)); + } else { + memcpy(&w->hdr.boot_metadata_res_entry, + &w->image_metadata[ + boot_idx - 1].metadata_lte->resource_entry, + sizeof(struct resource_entry)); + } + return 0; }