]> wimlib.net Git - wimlib/blobdiff - src/win32_capture.c
Consistently forbid directory hard links from being honored on capture
[wimlib] / src / win32_capture.c
index db2ea0ec7a8afa4a5513abd14730f89da6cd9330..8937891e75ee205376142a627264470d8e00fb07 100644 (file)
@@ -248,11 +248,11 @@ winnt_get_short_name(HANDLE h, struct wim_dentry *dentry)
                                                FileAlternateNameInformation);
        info = (const FILE_NAME_INFORMATION *)buf;
        if (NT_SUCCESS(status) && info->FileNameLength != 0) {
-               dentry->short_name = utf16le_dupz(info->FileName,
-                                                 info->FileNameLength);
-               if (!dentry->short_name)
+               dentry->d_short_name = utf16le_dupz(info->FileName,
+                                                   info->FileNameLength);
+               if (!dentry->d_short_name)
                        return STATUS_NO_MEMORY;
-               dentry->short_name_nbytes = info->FileNameLength;
+               dentry->d_short_name_nbytes = info->FileNameLength;
        }
        return status;
 }
@@ -415,9 +415,8 @@ winnt_recurse_directory(HANDLE h,
        {
                const FILE_NAMES_INFORMATION *info = buf;
                for (;;) {
-                       if (!(info->FileNameLength == 2 && info->FileName[0] == L'.') &&
-                           !(info->FileNameLength == 4 && info->FileName[0] == L'.' &&
-                                                          info->FileName[1] == L'.'))
+                       if (!should_ignore_filename(info->FileName,
+                                                   info->FileNameLength / 2))
                        {
                                wchar_t *p;
                                wchar_t *filename;
@@ -450,8 +449,7 @@ winnt_recurse_directory(HANDLE h,
 
                                if (ret)
                                        goto out_free_buf;
-                               if (child)
-                                       dentry_add_child(parent, child);
+                               attach_scanned_tree(parent, child, params->blob_table);
                        }
                        if (info->NextEntryOffset == 0)
                                break;
@@ -744,6 +742,8 @@ winnt_load_reparse_data(HANDLE h, struct wim_inode *inode,
        }
 
        inode->i_reparse_tag = le32_to_cpu(rpbuf.rptag);
+       inode->i_rp_reserved = le16_to_cpu(rpbuf.rpreserved);
+
        if (!inode_add_stream_with_data(inode,
                                        STREAM_TYPE_REPARSE_POINT,
                                        NO_STREAM_NAME,
@@ -1208,10 +1208,10 @@ winnt_build_dentry_tree_recursive(struct wim_dentry **root_ret,
        ACCESS_MASK requestedPerms;
        u64 sort_key;
 
-       ret = try_exclude(full_path, full_path_nchars, params);
-       if (ret < 0) /* Excluded? */
+       ret = try_exclude(full_path, params);
+       if (unlikely(ret < 0)) /* Excluded? */
                goto out_progress;
-       if (ret > 0) /* Error? */
+       if (unlikely(ret > 0)) /* Error? */
                goto out;
 
        /* Open the file.  */
@@ -1290,8 +1290,7 @@ retry_open:
                                     filename,
                                     file_info.ino,
                                     params->capture_root_dev,
-                                    (file_info.num_links <= 1 ||
-                                       (file_info.attributes & FILE_ATTRIBUTE_DIRECTORY)),
+                                    (file_info.num_links <= 1),
                                     &root);
        if (ret)
                goto out;