/* OPTIONAL: Extracted encrypted stream. In start_extract(), set
* ctx->supported_features.encrypted_files if supported. */
int (*extract_encrypted_stream)
- (file_spec_t file, struct wim_lookup_table_entry *lte,
+ (const tchar *path, struct wim_lookup_table_entry *lte,
struct apply_ctx *ctx);
/* OPTIONAL: Set file attributes. Calling code calls this if non-NULL.
/* OPTIONAL: Set to 1 if set_file_attributes() needs to be called a
* second time towards the end of the extraction. */
unsigned requires_final_set_attributes_pass : 1;
+
+ /* OPTIONAL: Set to 1 if extract_encrypted_stream() must be used to
+ * create encrypted files. */
+ unsigned extract_encrypted_stream_creates_file : 1;
};
struct wim_features {
ERROR_WITH_ERRNO("Failed to create the directory "
"\"%"TS"\"", path);
}
+ } else if ((inode->i_attributes & FILE_ATTRIBUTE_ENCRYPTED) &&
+ ctx->ops->extract_encrypted_stream_creates_file &&
+ ctx->supported_features.encrypted_files) {
+ ret = ctx->ops->extract_encrypted_stream(
+ path, inode_unnamed_lte_resolved(inode), ctx);
+ if (ret) {
+ ERROR_WITH_ERRNO("Failed to create and extract "
+ "encrypted file \"%"TS"\"", path);
+ }
} else {
ret = ctx->ops->create_file(path, ctx, &inode->extract_cookie);
if (ret) {
if (!(inode->i_attributes & (FILE_ATTRIBUTE_DIRECTORY |
FILE_ATTRIBUTE_REPARSE_POINT)))
{
- if ((inode->i_attributes & FILE_ATTRIBUTE_ENCRYPTED) &&
- ctx->supported_features.encrypted_files)
- ret = ctx->ops->extract_encrypted_stream(file_spec, lte, ctx);
- else
- ret = ctx->ops->extract_unnamed_stream(file_spec, lte, ctx);
- if (ret)
- goto error;
+ if (inode->i_attributes & FILE_ATTRIBUTE_ENCRYPTED &&
+ ctx->supported_features.encrypted_files) {
+ if (!ctx->ops->extract_encrypted_stream_creates_file) {
+ ret = ctx->ops->extract_encrypted_stream(
+ path, lte, ctx);
+ if (ret)
+ goto error;
+ }
+ } else {
+ ret = ctx->ops->extract_unnamed_stream(
+ file_spec, lte, ctx);
+ if (ret)
+ goto error;
+ }
update_extract_progress(ctx, lte);
}
else if (inode->i_attributes & FILE_ATTRIBUTE_REPARSE_POINT)
}
static int
-win32_extract_encrypted_stream(file_spec_t file,
+win32_extract_encrypted_stream(const wchar_t *path,
struct wim_lookup_table_entry *lte,
struct apply_ctx *ctx)
{
- const tchar *path = file.path;
void *file_ctx;
DWORD err;
int ret;
.realpath_works_on_nonexisting_files = 1,
.root_directory_is_special = 1,
.requires_final_set_attributes_pass = 1,
+ .extract_encrypted_stream_creates_file = 1,
};
#endif /* __WIN32__ */