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;
}
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;
}
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;
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;
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;
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;
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;
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;