if (is_named_stream) {
spath_nchars += 1 + stream_name_nchars;
colonchar = L":";
- if (path_num_chars == 1 &&
- path[0] != L'/' &&
- path[0] != L'\\')
- {
+ if (path_num_chars == 1 && !is_any_path_separator(path[0])) {
spath_nchars += 2;
static const wchar_t _relpath_prefix[] =
{L'.', OS_PREFERRED_PATH_SEPARATOR, L'\0'};
goto out_free_spath;
lte->resource_entry.original_size = encrypted_size;
} else {
- lte->resource_location = RESOURCE_WIN32;
+ lte->resource_location = RESOURCE_IN_FILE_ON_DISK;
lte->resource_entry.original_size = (u64)dat->StreamSize.QuadPart;
}
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 (ret)
return ret;
- win32_get_vol_flags(root_disk_path, &vol_flags);
+ win32_get_vol_flags(root_disk_path, &vol_flags, NULL);
/* WARNING: There is no check for overflow later when this buffer is
* being used! But it's as long as the maximum path length understood
} 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);
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);