]> wimlib.net Git - wimlib/blobdiff - src/win32_capture.c
Remove some dead assignments
[wimlib] / src / win32_capture.c
index 09dc3edc251a0d5407d4856202116425685d55d1..bc5422e85c7feaeebfcd2989aaea0f93b6fdb802 100644 (file)
@@ -45,7 +45,6 @@
 struct winnt_scan_stats {
        unsigned long num_get_sd_access_denied;
        unsigned long num_get_sacl_priv_notheld;
-       unsigned long num_long_path_warnings;
 };
 
 static inline const wchar_t *
@@ -84,9 +83,7 @@ winnt_openat(HANDLE cur_dir, const wchar_t *path, size_t path_nchars,
 
 retry:
        status = (*func_NtOpenFile)(h_ret, perms, &attr, &iosb,
-                                   FILE_SHARE_READ |
-                                           FILE_SHARE_WRITE |
-                                           FILE_SHARE_DELETE,
+                                   FILE_SHARE_VALID_FLAGS,
                                    FILE_OPEN_REPARSE_POINT |
                                            FILE_OPEN_FOR_BACKUP_INTENT |
                                            FILE_SYNCHRONOUS_IO_NONALERT |
@@ -591,13 +588,30 @@ out_close_root_dir:
        return p;
 }
 
-static enum rp_status
+static int
+winnt_rpfix_progress(struct add_image_params *params, const wchar_t *path,
+                    const struct reparse_data *rpdata,
+                    enum wimlib_progress_msg msg)
+{
+       size_t print_name_nchars = rpdata->print_name_nbytes / sizeof(wchar_t);
+       wchar_t print_name0[print_name_nchars + 1];
+
+       wmemcpy(print_name0, rpdata->print_name, print_name_nchars);
+       print_name0[print_name_nchars] = L'\0';
+
+       params->progress.scan.cur_path = printable_path(path);
+       params->progress.scan.symlink_target = print_name0;
+       return do_capture_progress(params, msg, NULL);
+}
+
+static int
 winnt_try_rpfix(u8 *rpbuf, u16 *rpbuflen_p,
                u64 capture_root_ino, u64 capture_root_dev,
                const wchar_t *path, struct add_image_params *params)
 {
        struct reparse_data rpdata;
        const wchar_t *rel_target;
+       int ret;
 
        if (parse_reparse_data(rpbuf, *rpbuflen_p, &rpdata)) {
                /* Couldn't even understand the reparse data.  Don't try the
@@ -639,14 +653,10 @@ winnt_try_rpfix(u8 *rpbuf, u16 *rpbuflen_p,
                /* Target points outside of the tree being captured.  Exclude
                 * this reparse point from the capture (but inform the library
                 * user).  */
-               size_t print_name_nchars = rpdata.print_name_nbytes / sizeof(wchar_t);
-               wchar_t print_name0[print_name_nchars + 1];
-               print_name0[print_name_nchars] = L'\0';
-               wmemcpy(print_name0, rpdata.print_name, print_name_nchars);
-
-               params->progress.scan.cur_path = printable_path(path);
-               params->progress.scan.symlink_target = print_name0;
-               do_capture_progress(params, WIMLIB_SCAN_DENTRY_EXCLUDED_SYMLINK, NULL);
+               ret = winnt_rpfix_progress(params, path, &rpdata,
+                                          WIMLIB_SCAN_DENTRY_EXCLUDED_SYMLINK);
+               if (ret)
+                       return ret;
                return RP_EXCLUDED;
        }
 
@@ -686,6 +696,10 @@ winnt_try_rpfix(u8 *rpbuf, u16 *rpbuflen_p,
                if (make_reparse_buffer(&rpdata, rpbuf, rpbuflen_p))
                        return RP_NOT_FIXED;
        }
+       ret = winnt_rpfix_progress(params, path, &rpdata,
+                                  WIMLIB_SCAN_DENTRY_FIXED_SYMLINK);
+       if (ret)
+               return ret;
        return RP_FIXED;
 }
 
@@ -700,7 +714,7 @@ winnt_try_rpfix(u8 *rpbuf, u16 *rpbuflen_p,
  *     Path to the reparse point file.
  * @params:
  *     Capture parameters.  add_flags, capture_root_ino, capture_root_dev,
- *     progress_func, and progress are used.
+ *     progfunc, progctx, and progress are used.
  * @rpbuf:
  *     Buffer of length at least REPARSE_POINT_MAX_SIZE bytes into which the
  *     reparse point buffer will be loaded.
@@ -1080,10 +1094,7 @@ winnt_build_dentry_tree_recursive(struct wim_dentry **root_ret,
        if (should_exclude_path(full_path + params->capture_root_nchars,
                                full_path_nchars - params->capture_root_nchars,
                                params->config))
-       {
-               ret = 0;
                goto out_progress;
-       }
 
        /* Open the file.  */
        status = winnt_openat(cur_dir,
@@ -1242,7 +1253,6 @@ winnt_build_dentry_tree_recursive(struct wim_dentry **root_ret,
        if (inode->i_nlink > 1) {
                /* Shared inode (hard link); skip reading per-inode information.
                 */
-               ret = 0;
                goto out_progress;
        }
 
@@ -1331,9 +1341,9 @@ winnt_build_dentry_tree_recursive(struct wim_dentry **root_ret,
 out_progress:
        params->progress.scan.cur_path = printable_path(full_path);
        if (likely(root))
-               do_capture_progress(params, WIMLIB_SCAN_DENTRY_OK, inode);
+               ret = do_capture_progress(params, WIMLIB_SCAN_DENTRY_OK, inode);
        else
-               do_capture_progress(params, WIMLIB_SCAN_DENTRY_EXCLUDED, NULL);
+               ret = do_capture_progress(params, WIMLIB_SCAN_DENTRY_EXCLUDED, NULL);
 out:
        if (likely(h != INVALID_HANDLE_VALUE))
                (*func_NtClose)(h);