X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Flookup_table.c;h=37d701a1e49403efc7c6387c537c13d05bf62fdd;hp=2a5bac311ff4b11835b52a091ecf37320d790d7e;hb=b072e7cbca1ccb874e22aa94e3efae37ce211939;hpb=465a630d28e93b09e55ca07b1a6cae8def3b42f5 diff --git a/src/lookup_table.c b/src/lookup_table.c index 2a5bac31..37d701a1 100644 --- a/src/lookup_table.c +++ b/src/lookup_table.c @@ -574,6 +574,13 @@ read_wim_lookup_table(WIMStruct *wim) if (cur_entry->resource_entry.flags & WIM_RESHDR_FLAG_METADATA) { /* Lookup table entry for a metadata resource */ if (cur_entry->refcnt != 1) { + /* Metadata entries with no references must be + * ignored. See for example the WinPE WIMs from + * WAIK v2.1. */ + if (cur_entry->refcnt == 0) { + free_lookup_table_entry(cur_entry); + continue; + } if (wimlib_print_errors) { ERROR("Found metadata resource with refcnt != 1:"); print_lookup_table_entry(cur_entry, stderr); @@ -1035,7 +1042,7 @@ out: #endif int -resource_not_found_error(struct wim_inode *inode, const u8 *hash) +resource_not_found_error(const struct wim_inode *inode, const u8 *hash) { if (wimlib_print_errors) { ERROR("\"%"TS"\": resource not found", inode_first_full_path(inode)); @@ -1214,6 +1221,22 @@ inode_unnamed_lte(const struct wim_inode *inode, return inode_unnamed_lte_unresolved(inode, table); } +const u8 * +inode_unnamed_stream_hash(const struct wim_inode *inode) +{ + const u8 *hash; + + for (unsigned i = 0; i <= inode->i_num_ads; i++) { + if (inode_stream_name_nbytes(inode, i) == 0) { + hash = inode_stream_hash(inode, i); + if (!is_zero_hash(hash)) + return hash; + } + } + return NULL; +} + + static int lte_add_stream_size(struct wim_lookup_table_entry *lte, void *total_bytes_p) { @@ -1380,8 +1403,6 @@ reference_resource_paths(WIMStruct *wim, unsigned i; int ret; - open_flags |= WIMLIB_OPEN_FLAG_SPLIT_OK; - resource_wims = CALLOC(num_resource_wimfiles, sizeof(resource_wims[0])); if (!resource_wims) return WIMLIB_ERR_NOMEM;