+static int
+ntfs_3g_restore_reparse_point(ntfs_inode *ni, const struct wim_inode *inode,
+ unsigned blob_size, struct ntfs_3g_apply_ctx *ctx)
+{
+ complete_reparse_point(&ctx->rpbuf, inode, blob_size);
+
+ if (ntfs_set_ntfs_reparse_data(ni, (const char *)&ctx->rpbuf,
+ REPARSE_DATA_OFFSET + blob_size, 0))
+ {
+ int err = errno;
+ ERROR_WITH_ERRNO("Failed to set reparse data on \"%s\"",
+ dentry_full_path(
+ inode_first_extraction_dentry(inode)));
+ if (err == EINVAL && !(inode->i_reparse_tag & 0x80000000)) {
+ WARNING("This reparse point had a non-Microsoft reparse "
+ "tag. The preceding error may have been caused "
+ "by a known bug in libntfs-3g where it does not "
+ "correctly validate non-Microsoft reparse "
+ "points. This bug may be fixed in the 2016 "
+ "release of libntfs-3g.");
+ }
+ return WIMLIB_ERR_SET_REPARSE_DATA;
+ }
+
+ return 0;
+}
+
+static bool
+ntfs_3g_has_empty_attributes(const struct wim_inode *inode)
+{
+ for (unsigned i = 0; i < inode->i_num_streams; i++) {
+ const struct wim_inode_stream *strm = &inode->i_streams[i];
+
+ if (stream_blob_resolved(strm) == NULL &&
+ (strm->stream_type == STREAM_TYPE_REPARSE_POINT ||
+ stream_is_named_data_stream(strm)))
+ return true;
+ }
+ return false;
+}
+