+ return &w->image_metadata[
+ w->current_image - 1].metadata_lte->resource_entry;
+}
+
+static inline struct lookup_table_entry *
+dentry_stream_lte_resolved(const struct dentry *dentry, unsigned stream_idx)
+{
+ wimlib_assert(dentry->resolved);
+ wimlib_assert(stream_idx <= dentry->num_ads);
+ if (stream_idx == 0)
+ return dentry->lte;
+ else
+ return dentry->ads_entries[stream_idx - 1].lte;
+}
+
+static inline struct lookup_table_entry *
+dentry_stream_lte_unresolved(const struct dentry *dentry, unsigned stream_idx,
+ const struct lookup_table *table)
+{
+ wimlib_assert(!dentry->resolved);
+ wimlib_assert(stream_idx <= dentry->num_ads);
+ if (!table)
+ return NULL;
+ if (stream_idx == 0)
+ return __lookup_resource(table, dentry->hash);
+ else
+ return __lookup_resource(table,
+ dentry->ads_entries[
+ stream_idx - 1].hash);
+}
+/*
+ * Returns the lookup table entry for stream @stream_idx of the dentry, where
+ * stream_idx = 0 means the default un-named file stream, and stream_idx >= 1
+ * corresponds to an alternate data stream.
+ *
+ * This works for both resolved and un-resolved dentries.
+ */
+static inline struct lookup_table_entry *
+dentry_stream_lte(const struct dentry *dentry, unsigned stream_idx,
+ const struct lookup_table *table)
+{
+ if (dentry->resolved)
+ return dentry_stream_lte_resolved(dentry, stream_idx);
+ else
+ return dentry_stream_lte_unresolved(dentry, stream_idx, table);
+}
+
+
+static inline const u8 *dentry_stream_hash_unresolved(const struct dentry *dentry,
+ unsigned stream_idx)
+{
+ wimlib_assert(!dentry->resolved);
+ wimlib_assert(stream_idx <= dentry->num_ads);
+ if (stream_idx == 0)
+ return dentry->hash;
+ else
+ return dentry->ads_entries[stream_idx - 1].hash;