+ /* Lookup table entries with 'out_refcnt' == 0 correspond to streams not
+ * written and not present in the resulting WIM file, and should not be
+ * included in the lookup table.
+ *
+ * Lookup table entries marked as filtered (EXTERNAL_WIM) with
+ * 'out_refcnt != 0' were referenced as part of the logical write but
+ * correspond to streams that were not in fact written, and should not
+ * be included in the lookup table.
+ *
+ * Lookup table entries marked as filtered (SAME_WIM) with 'out_refcnt
+ * != 0' were referenced as part of the logical write but correspond to
+ * streams that were not in fact written, but nevertheless were already
+ * present in the WIM being overwritten in-place. These entries must be
+ * included in the lookup table, and the resource information to write
+ * needs to be copied from the resource information read originally.
+ */
+ if (lte->out_refcnt != 0 && !(lte->filtered & FILTERED_EXTERNAL_WIM)) {
+ if (lte->filtered & FILTERED_SAME_WIM) {
+ copy_resource_entry(<e->output_resource_entry,
+ <e->resource_entry);
+ }