X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fwin32_apply.c;h=48dd66d319637769b881086ffae72e54581bba1e;hb=bb6773105af4072cf0ce7e6c8276632d6110b03b;hp=b6f2e84c3b5d1be6230d7a0596ee3a94818b0544;hpb=fd0584f6e32ed9ef19899b29d5f9aa6f4d9432f3;p=wimlib diff --git a/src/win32_apply.c b/src/win32_apply.c index b6f2e84c..48dd66d3 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -259,11 +259,10 @@ win32_encrypted_import_cb(unsigned char *data, void *_import_ctx, } 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; @@ -271,7 +270,7 @@ win32_extract_encrypted_stream(file_spec_t file, err = OpenEncryptedFileRaw(path, CREATE_FOR_IMPORT, &file_ctx); if (err != ERROR_SUCCESS) { - errno = win32_error_to_errno(err); + set_errno_from_win32_error(err); ret = WIMLIB_ERR_OPEN; goto out; } @@ -281,7 +280,7 @@ win32_extract_encrypted_stream(file_spec_t file, err = WriteEncryptedFileRaw(win32_encrypted_import_cb, &extract_ctx, file_ctx); if (err != ERROR_SUCCESS) { - errno = win32_error_to_errno(err); + set_errno_from_win32_error(err); ret = WIMLIB_ERR_WRITE; goto out_close; } @@ -301,10 +300,7 @@ win32_set_special_file_attributes(const wchar_t *path, u32 attributes) USHORT compression_format = COMPRESSION_FORMAT_DEFAULT; DWORD bytes_returned; - h = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | - FILE_FLAG_OPEN_REPARSE_POINT, - NULL); + h = win32_open_existing_file(path, GENERIC_READ | GENERIC_WRITE); if (h == INVALID_HANDLE_VALUE) goto error; @@ -388,10 +384,7 @@ win32_set_file_attributes(const wchar_t *path, u32 attributes, DWORD bytes_returned; USHORT compression_format = COMPRESSION_FORMAT_NONE; - h = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | - FILE_FLAG_OPEN_REPARSE_POINT, - NULL); + h = win32_open_existing_file(path, GENERIC_READ | GENERIC_WRITE); if (h == INVALID_HANDLE_VALUE) goto error; @@ -425,10 +418,7 @@ win32_set_reparse_data(const wchar_t *path, const u8 *rpbuf, u16 rpbuflen, DWORD err; DWORD bytes_returned; - h = CreateFile(path, GENERIC_WRITE, 0, NULL, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | - FILE_FLAG_OPEN_REPARSE_POINT, - NULL); + h = win32_open_existing_file(path, GENERIC_WRITE); if (h == INVALID_HANDLE_VALUE) goto error; @@ -458,10 +448,7 @@ win32_set_short_name(const wchar_t *path, const wchar_t *short_name, HANDLE h; DWORD err; - h = CreateFile(path, GENERIC_WRITE | DELETE, 0, NULL, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | - FILE_FLAG_OPEN_REPARSE_POINT, - NULL); + h = win32_open_existing_file(path, GENERIC_WRITE | DELETE); if (h == INVALID_HANDLE_VALUE) goto error; @@ -516,10 +503,7 @@ win32_set_security_descriptor(const wchar_t *path, const u8 *desc, h = INVALID_HANDLE_VALUE; #ifdef WITH_NTDLL - h = CreateFile(path, MAXIMUM_ALLOWED, 0, NULL, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS | - FILE_FLAG_OPEN_REPARSE_POINT, - NULL); + h = win32_open_existing_file(path, MAXIMUM_ALLOWED); if (h == INVALID_HANDLE_VALUE) { ERROR_WITH_ERRNO("Can't open %ls (%u)", path, GetLastError()); goto error; @@ -581,10 +565,7 @@ win32_set_timestamps(const wchar_t *path, u64 creation_time, FILETIME lastWriteTime = {.dwLowDateTime = last_write_time & 0xffffffff, .dwHighDateTime = last_write_time >> 32}; - h = CreateFile(path, FILE_WRITE_ATTRIBUTES, 0, NULL, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | - FILE_FLAG_OPEN_REPARSE_POINT, - NULL); + h = win32_open_existing_file(path, FILE_WRITE_ATTRIBUTES); if (h == INVALID_HANDLE_VALUE) goto error; @@ -632,6 +613,8 @@ const struct apply_operations win32_apply_ops = { .realpath_works_on_nonexisting_files = 1, .root_directory_is_special = 1, .requires_final_set_attributes_pass = 1, + .extract_encrypted_stream_creates_file = 1, + .requires_short_name_reordering = 1, /* TODO: check if this is really needed */ }; #endif /* __WIN32__ */