X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fheader.c;h=6f9668a5d6c9f15d738f2d59dd831bc6659472b6;hp=c7bad0f22f88b7c07099726e427370baefa0a48a;hb=4f9947253f6a08f4a922d3efe0880e3039b3eb5e;hpb=393e8e46f87e6119f85b7fc9910624f567c5a34b diff --git a/src/header.c b/src/header.c index c7bad0f2..6f9668a5 100644 --- a/src/header.c +++ b/src/header.c @@ -165,10 +165,14 @@ int write_header(const struct wim_header *hdr, FILE *out) p = put_u32(p, hdr->flags); p = put_u32(p, (hdr->flags & WIM_HDR_FLAG_COMPRESSION) ? WIM_CHUNK_SIZE : 0); - randomize_byte_array(p, WIM_GID_LEN); - p += WIM_GID_LEN; - p = put_u16(p, 1); /* part number */ - p = put_u16(p, 1); /* total parts */ + /* byte 24 */ + + p = put_bytes(p, WIM_GID_LEN, hdr->guid); + p = put_u16(p, hdr->part_number); + + /* byte 40 */ + + p = put_u16(p, hdr->total_parts); p = put_u32(p, hdr->image_count); p = put_resource_entry(p, &hdr->lookup_table_res_entry); p = put_resource_entry(p, &hdr->xml_res_entry); @@ -205,6 +209,8 @@ int init_header(struct wim_header *hdr, int ctype) ERROR("Invalid compression type specified (%d)!\n", ctype); return WIMLIB_ERR_INVALID_COMPRESSION_TYPE; } + hdr->total_parts = 1; + hdr->part_number = 1; randomize_byte_array(hdr->guid, sizeof(hdr->guid)); return 0; }