#include "wimlib/error.h"
#include "wimlib/metadata.h"
#include "wimlib/paths.h"
+#include "wimlib/pattern.h"
#include "wimlib/reparse.h"
#include "wimlib/textfile.h"
#include "wimlib/xml.h"
-#include "wimlib/wildcard.h"
#include "wimlib/wimboot.h"
struct win32_apply_ctx {
* beginning of the array) */
unsigned num_open_handles;
- /* List of dentries, joined by @tmp_list, that need to have reparse data
- * extracted as soon as the whole blob has been read into @data_buffer.
- * */
+ /* List of dentries, joined by @d_tmp_list, that need to have reparse
+ * data extracted as soon as the whole blob has been read into
+ * @data_buffer. */
struct list_head reparse_dentries;
- /* List of dentries, joined by @tmp_list, that need to have raw
+ /* List of dentries, joined by @d_tmp_list, that need to have raw
* encrypted data extracted as soon as the whole blob has been read into
* @data_buffer. */
struct list_head encrypted_dentries;
return 0;
}
-/* Returns %true if the specified absolute path to a file in the WIM image
- * matches a pattern in [PrepopulateList] of WimBootCompress.ini. Otherwise
- * returns %false. */
-static bool
-in_prepopulate_list(const wchar_t *path, size_t path_nchars,
- const struct win32_apply_ctx *ctx)
-{
- const struct string_set *pats = ctx->wimboot.prepopulate_pats;
-
- if (!pats || !pats->num_strings)
- return false;
-
- return match_pattern_list(path, path_nchars, pats);
-}
-
/* Returns %true if the specified absolute path to a file in the WIM image can
* be subject to external backing when extracted. Otherwise returns %false. */
static bool
-can_externally_back_path(const wchar_t *path, size_t path_nchars,
- const struct win32_apply_ctx *ctx)
+can_externally_back_path(const wchar_t *path, const struct win32_apply_ctx *ctx)
{
- if (in_prepopulate_list(path, path_nchars, ctx))
+ /* Does the path match a pattern given in the [PrepopulateList] section
+ * of WimBootCompress.ini? */
+ if (ctx->wimboot.prepopulate_pats &&
+ match_pattern_list(path, ctx->wimboot.prepopulate_pats))
return false;
/* Since we attempt to modify the SYSTEM registry after it's extracted
* However, a WIM that wasn't specifically captured in "WIMBoot mode"
* may contain SYSTEM.* files. So to make things "just work", hard-code
* the pattern. */
- if (match_path(path, path_nchars, L"\\Windows\\System32\\config\\SYSTEM*",
- OS_PREFERRED_PATH_SEPARATOR, false))
+ if (match_path(path, L"\\Windows\\System32\\config\\SYSTEM*", false))
return false;
return true;
if (ret)
return ret;
- if (!can_externally_back_path(dentry->_full_path,
- wcslen(dentry->_full_path), ctx))
- {
+ if (!can_externally_back_path(dentry->d_full_path, ctx)) {
if (excluded_dentry_ret)
*excluded_dentry_ret = dentry;
return WIM_BACKING_EXCLUDED;
build_extraction_path(excluded_dentry, ctx);
- info.wimboot_exclude.path_in_wim = excluded_dentry->_full_path;
+ info.wimboot_exclude.path_in_wim = excluded_dentry->d_full_path;
info.wimboot_exclude.extraction_path = current_path(ctx);
return call_progress(ctx->common.progfunc,
name = &ctx->pathbuf.Buffer[ctx->pathbuf.Length / sizeof(wchar_t)];
while (name != ctx->pathbuf.Buffer && *(name - 1) != L'\\')
name--;
- end = mempcpy(name, dentry->short_name, dentry->short_name_nbytes);
+ end = mempcpy(name, dentry->d_short_name, dentry->d_short_name_nbytes);
ctx->pathbuf.Length = ((u8 *)end - (u8 *)ctx->pathbuf.Buffer);
/* Open the conflicting file (by short name). */
*/
size_t bufsize = offsetof(FILE_NAME_INFORMATION, FileName) +
- max(dentry->short_name_nbytes, sizeof(wchar_t)) +
+ max(dentry->d_short_name_nbytes, sizeof(wchar_t)) +
sizeof(wchar_t);
u8 buf[bufsize] _aligned_attribute(8);
FILE_NAME_INFORMATION *info = (FILE_NAME_INFORMATION *)buf;
memset(buf, 0, bufsize);
- info->FileNameLength = dentry->short_name_nbytes;
- memcpy(info->FileName, dentry->short_name, dentry->short_name_nbytes);
+ info->FileNameLength = dentry->d_short_name_nbytes;
+ memcpy(info->FileName, dentry->d_short_name, dentry->d_short_name_nbytes);
retry:
status = (*func_NtSetInformationFile)(h, &ctx->iosb, info, bufsize,
return 0;
if (status == STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME) {
- if (dentry->short_name_nbytes == 0)
+ if (dentry->d_short_name_nbytes == 0)
return 0;
if (!ctx->tried_to_enable_short_names) {
wchar_t volume[7];
* from files.
*/
if (unlikely(status == STATUS_OBJECT_NAME_COLLISION) &&
- dentry->short_name_nbytes && !tried_to_remove_existing)
+ dentry->d_short_name_nbytes && !tried_to_remove_existing)
{
tried_to_remove_existing = true;
status = remove_conflicting_short_name(dentry, ctx);
/* By default, failure to set short names is not an error (since short
* names aren't too important anymore...). */
if (!(ctx->common.extract_flags & WIMLIB_EXTRACT_FLAG_STRICT_SHORT_NAMES)) {
- if (dentry->short_name_nbytes)
+ if (dentry->d_short_name_nbytes)
ctx->num_set_short_name_failures++;
else
ctx->num_remove_short_name_failures++;
* data be available. So, stage the data in a buffer. */
if (!prepare_data_buffer(ctx, blob->size))
return WIMLIB_ERR_NOMEM;
- list_add_tail(&dentry->tmp_list, &ctx->reparse_dentries);
+ list_add_tail(&dentry->d_tmp_list, &ctx->reparse_dentries);
return 0;
}
* such files... */
if (!prepare_data_buffer(ctx, blob->size))
return WIMLIB_ERR_NOMEM;
- list_add_tail(&dentry->tmp_list, &ctx->encrypted_dentries);
+ list_add_tail(&dentry->d_tmp_list, &ctx->encrypted_dentries);
return 0;
}
if (!list_empty(&ctx->reparse_dentries)) {
if (blob->size > REPARSE_DATA_MAX_SIZE) {
dentry = list_first_entry(&ctx->reparse_dentries,
- struct wim_dentry, tmp_list);
+ struct wim_dentry, d_tmp_list);
build_extraction_path(dentry, ctx);
ERROR("Reparse data of \"%ls\" has size "
"%"PRIu64" bytes (exceeds %u bytes)",
/* Reparse data */
memcpy(ctx->rpbuf.rpdata, ctx->data_buffer, blob->size);
- list_for_each_entry(dentry, &ctx->reparse_dentries, tmp_list) {
+ list_for_each_entry(dentry, &ctx->reparse_dentries, d_tmp_list) {
/* Reparse point header */
complete_reparse_point(&ctx->rpbuf, dentry->d_inode,
if (!list_empty(&ctx->encrypted_dentries)) {
ctx->encrypted_size = blob->size;
- list_for_each_entry(dentry, &ctx->encrypted_dentries, tmp_list) {
+ list_for_each_entry(dentry, &ctx->encrypted_dentries, d_tmp_list) {
ret = extract_encrypted_file(dentry, ctx);
ret = check_apply_error(dentry, ctx, ret);
if (ret)