The switch to using \\?\-prefixed paths made excluding files stop working
on Windows. Fix it.
struct wimlib_pattern_list reserved2;
/** Library internal use only. */
struct wimlib_pattern_list reserved2;
/** Library internal use only. */
- const wimlib_tchar *_prefix;
/** Library internal use only. */
size_t _prefix_num_tchars;
/** Library internal use only. */
size_t _prefix_num_tchars;
/* Pointer to the capture configuration, which indicates whether any
* files should be excluded from capture or not. */
/* Pointer to the capture configuration, which indicates whether any
* files should be excluded from capture or not. */
- const struct wimlib_capture_config *config;
+ struct wimlib_capture_config *config;
/* Flags that affect the capture operation (WIMLIB_ADD_FLAG_*) */
int add_flags;
/* Flags that affect the capture operation (WIMLIB_ADD_FLAG_*) */
int add_flags;
struct win32_capture_state state;
unsigned vol_flags;
DWORD dret;
struct win32_capture_state state;
unsigned vol_flags;
DWORD dret;
+ bool need_prefix_free = false;
if (!win32func_FindFirstStreamW) {
WARNING("Running on Windows XP or earlier; "
if (!win32func_FindFirstStreamW) {
WARNING("Running on Windows XP or earlier; "
} else {
wmemcpy(path, L"\\\\?\\", 4);
path_nchars = 4 + dret;
} else {
wmemcpy(path, L"\\\\?\\", 4);
path_nchars = 4 + dret;
+ /* Update pattern prefix */
+ if (params->config != NULL)
+ {
+ params->config->_prefix = TSTRDUP(path);
+ params->config->_prefix_num_tchars = path_nchars;
+ if (params->config->_prefix == NULL)
+ {
+ ret = WIMLIB_ERR_NOMEM;
+ goto out_free_path;
+ }
+ need_prefix_free = true;
+ }
}
} else {
wmemcpy(path, root_disk_path, path_nchars + 1);
}
} else {
wmemcpy(path, root_disk_path, path_nchars + 1);
ret = win32_build_dentry_tree_recursive(root_ret, path,
path_nchars, params,
&state, vol_flags);
ret = win32_build_dentry_tree_recursive(root_ret, path,
path_nchars, params,
&state, vol_flags);
+ if (need_prefix_free)
+ FREE(params->config->_prefix);
+out_free_path:
FREE(path);
if (ret == 0)
win32_do_capture_warnings(&state, params->add_flags);
FREE(path);
if (ret == 0)
win32_do_capture_warnings(&state, params->add_flags);