- dentry->creation_time = le64_to_cpu(ni->creation_time);
- dentry->last_write_time = le64_to_cpu(ni->last_data_change_time);
- dentry->last_access_time = le64_to_cpu(ni->last_access_time);
- dentry->security_id = le32_to_cpu(ni->security_id);
- dentry->attributes = le32_to_cpu(attributes);
- dentry->hard_link = ni->mft_no;
- dentry->resolved = true;
+ mrec_flags = ni->mrec->flags;
+ struct SECURITY_CONTEXT ctx;
+ memset(&ctx, 0, sizeof(ctx));
+ ctx.vol = ni->vol;
+ ret = ntfs_xattr_system_getxattr(&ctx, XATTR_NTFS_ATTRIB,
+ ni, dir_ni, (char *)&attributes,
+ sizeof(u32));
+ if (ret != 4) {
+ ERROR_WITH_ERRNO("Failed to get NTFS attributes from `%s'",
+ path);
+ return WIMLIB_ERR_NTFS_3G;
+ }
+
+ if ((add_image_flags & WIMLIB_ADD_IMAGE_FLAG_VERBOSE)
+ && progress_func)
+ {
+ union wimlib_progress_info info;
+ info.scan.cur_path = path;
+ info.scan.excluded = false;
+ progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
+ }
+
+ root = new_dentry_with_timeless_inode(path_basename(path));
+ if (!root) {
+ if (errno == EILSEQ)
+ return WIMLIB_ERR_INVALID_UTF8_STRING;
+ else if (errno == ENOMEM)
+ return WIMLIB_ERR_NOMEM;
+ else
+ return WIMLIB_ERR_ICONV_NOT_AVAILABLE;
+ }
+ *root_p = root;
+
+ if (dir_ni && (name_type == FILE_NAME_WIN32_AND_DOS
+ || name_type == FILE_NAME_WIN32))
+ {
+ char dos_name_utf8[12 * 4 + 1] = {0};
+ ret = ntfs_get_ntfs_dos_name(ni, dir_ni, dos_name_utf8,
+ sizeof(dos_name_utf8) - 1);
+ if (ret > 0) {
+ DEBUG("Changing short name of `%s'", path);
+ ret = change_dentry_short_name(root, dos_name_utf8,
+ ret);
+ if (ret != 0)
+ return ret;
+ } else {
+ #ifdef ENODATA
+ if (errno != ENODATA) {
+ ERROR_WITH_ERRNO("Error getting DOS name "
+ "of `%s'", path);
+ return WIMLIB_ERR_NTFS_3G;
+ }
+ #endif
+ }
+ }
+
+ root->d_inode->i_creation_time = le64_to_cpu(ni->creation_time);
+ root->d_inode->i_last_write_time = le64_to_cpu(ni->last_data_change_time);
+ root->d_inode->i_last_access_time = le64_to_cpu(ni->last_access_time);
+ root->d_inode->i_attributes = le32_to_cpu(attributes);
+ root->d_inode->i_ino = ni->mft_no;
+ root->d_inode->i_resolved = 1;