]> wimlib.net Git - wimlib/blobdiff - src/win32_capture.c
A few comment fixes
[wimlib] / src / win32_capture.c
index 09dc3edc251a0d5407d4856202116425685d55d1..27b3794fd436073d23d120800272ec1f50623941 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.
@@ -1331,9 +1345,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);