+static int
+stream_to_wimlib_stream_entry(const struct wim_inode *inode,
+ const struct wim_inode_stream *strm,
+ struct wimlib_stream_entry *wstream,
+ const struct blob_table *blob_table,
+ int flags)
+{
+ const struct blob_descriptor *blob;
+ const u8 *hash;
+
+ if (stream_is_named(strm)) {
+ size_t dummy;
+ int ret;
+
+ ret = utf16le_get_tstr(strm->stream_name,
+ utf16le_len_bytes(strm->stream_name),
+ &wstream->stream_name, &dummy);
+ if (ret)
+ return ret;
+ }
+
+ blob = stream_blob(strm, blob_table);
+ if (blob) {
+ blob_to_wimlib_resource_entry(blob, &wstream->resource);
+ } else if (!is_zero_hash((hash = stream_hash(strm)))) {
+ if (flags & WIMLIB_ITERATE_DIR_TREE_FLAG_RESOURCES_NEEDED)
+ return blob_not_found_error(inode, hash);
+ copy_hash(wstream->resource.sha1_hash, hash);
+ wstream->resource.is_missing = 1;
+ }
+ return 0;
+}
+
+static int
+get_default_stream_type(const struct wim_inode *inode)
+{
+ if (inode->i_attributes & FILE_ATTRIBUTE_ENCRYPTED)
+ return STREAM_TYPE_EFSRPC_RAW_DATA;
+ if (inode->i_attributes & FILE_ATTRIBUTE_REPARSE_POINT)
+ return STREAM_TYPE_REPARSE_POINT;
+ return STREAM_TYPE_DATA;
+}
+