]> wimlib.net Git - wimlib/blobdiff - src/win32_capture.c
Improved reporting of concurrent modifications and corruptions
[wimlib] / src / win32_capture.c
index 6285566811beaec3ea9c6b73982f93289dec4d92..0f608a8ff7d675e5ba81a7f9677ad99df7b15c82 100644 (file)
@@ -137,10 +137,16 @@ read_winnt_stream_prefix(const struct blob_descriptor *blob, u64 size,
 
                status = (*func_NtReadFile)(h, NULL, NULL, NULL,
                                            &iosb, buf, count, NULL, NULL);
-               if (!NT_SUCCESS(status)) {
-                       winnt_error(status, L"\"%ls\": Error reading data",
-                                   printable_path(path));
-                       ret = WIMLIB_ERR_READ;
+               if (unlikely(!NT_SUCCESS(status))) {
+                       if (status == STATUS_END_OF_FILE) {
+                               ERROR("\"%ls\": File was concurrently truncated",
+                                     printable_path(path));
+                               ret = WIMLIB_ERR_CONCURRENT_MODIFICATION_DETECTED;
+                       } else {
+                               winnt_error(status, L"\"%ls\": Error reading data",
+                                           printable_path(path));
+                               ret = WIMLIB_ERR_READ;
+                       }
                        break;
                }
 
@@ -415,9 +421,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 +455,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;
@@ -630,7 +634,7 @@ winnt_try_rpfix(struct reparse_buffer_disk *rpbuf, u16 *rpbuflen_p,
         * SYMBOLIC_LINK_RELATIVE.  We will use this information, although this
         * may not always do what the user expects, since drive-relative
         * symbolic links such as "\Users\Public" have SYMBOLIC_LINK_RELATIVE
-        * set, in addition to truely relative symbolic links such as "Users" or
+        * set, in addition to truly relative symbolic links such as "Users" or
         * "Users\Public".  However, WIMGAPI (as of Windows 8.1) has this same
         * behavior.
         *
@@ -1292,8 +1296,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;